Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
improved unit tests, fixed issue with new options in config in tests
  • Loading branch information
proost committed Nov 17, 2017
1 parent 90a9604 commit 6dcfeb9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions tests/config.py
Expand Up @@ -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()
Expand Down
10 changes: 5 additions & 5 deletions tests/utils.py
Expand Up @@ -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])

Expand Down

0 comments on commit 6dcfeb9

Please sign in to comment.