Skip to content
Permalink
Browse files

improved unit tests, fixed issue with new options in config in tests

  • Loading branch information
proost committed Nov 17, 2017
1 parent 90a9604 commit 6dcfeb9242e814f78ac6548ae82ae7d9dbd13575
Showing with 8 additions and 5 deletions.
  1. +3 −0 tests/config.py
  2. +5 −5 tests/utils.py
@@ -44,10 +44,13 @@
WHOOSHEE_MIN_STRING_LEN = 3
WHOOSHEE_WRITER_TIMEOUT = 2
WHOOSHEE_MEMORY_STORAGE = False
WHOOSHEE_ENABLE_INDEXING = True

# Minify pages when debug is off
MINIFY_PAGE = not DEBUG

TMP_DIR = tempfile.mkdtemp()

# BLAST settings
BLAST_ENABLED = False
BLAST_TMP_DIR = tempfile.mkdtemp()
@@ -13,14 +13,14 @@ def test_tau(self):
self.assertEqual(tau([1, 0, 0, 0, 0, 0]), 1)
self.assertEqual(tau([1, 1, 1, 1, 1, 1]), 0)
self.assertEqual(tau([0, 0, 0, 0, 0, 0]), None)
self.assertEqual("%.2f" % tau([0, 8, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0]), "0.95") # example from Yanai et al. 2005
self.assertAlmostEqual(tau([0, 8, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0]), 0.95, places=2) # example from Yanai et al. 2005

def test_enrichment(self):
self.assertEqual("%.3f" % hypergeo_cdf(2, 3, 10, 100), "0.999")
self.assertEqual("%.3f" % hypergeo_cdf(2, 6, 10, 100), "0.987")
self.assertAlmostEqual(hypergeo_cdf(2, 3, 10, 100), 0.999, places=3)
self.assertAlmostEqual(hypergeo_cdf(2, 6, 10, 100), 0.987, places=3)

self.assertEqual("%.3f" % hypergeo_sf(2, 3, 10, 100), "0.026")
self.assertEqual("%.3f" % hypergeo_sf(2, 6, 10, 100), "0.109")
self.assertAlmostEqual(hypergeo_sf(2, 3, 10, 100), 0.026, places=3)
self.assertAlmostEqual(hypergeo_sf(2, 6, 10, 100), 0.109, places=3)

self.assertEqual(fdr_correction([0.05, 0.06, 0.07]), [0.07, 0.07, 0.07])

0 comments on commit 6dcfeb9

Please sign in to comment.
You can’t perform that action at this time.