Skip to content

Commit

Permalink
add additional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mjohnpayne committed Apr 10, 2024
1 parent c04ed6f commit 5f8547a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions dodge/tests/test_dodge.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,23 @@ def test_empty_noisolate_metacols(self):
class TestGetStartEnd(unittest.TestCase):

def test_week_with_start_end_date(self):
startdate, enddate = dodge.dodge.get_start_end("week", "2024-01-01", "2024-01-07", {}, {})
startdate, enddate = dodge.get_start_end("week", "2024-01-01", "2024-01-07", {}, {})
self.assertEqual(startdate, datetime(2024, 1, 1))
self.assertEqual(enddate, datetime(2024, 1, 7))

def test_week_with_start_date_only(self):
startdate, enddate = dodge.dodge.get_start_end("week", "2024-01-01", None, {}, {})
startdate, enddate = dodge.get_start_end("week", "2024-01-01", None, {}, {})
self.assertEqual(startdate, datetime(2024, 1, 1))
# End date should be the newest strain date in this case

def test_week_with_end_date_only(self):
startdate, enddate = dodge.dodge.get_start_end("week", None, "2024-01-07", {}, {})
startdate, enddate = dodge.get_start_end("week", None, "2024-01-07", {}, {})
# Start date should be the oldest strain date in this case
self.assertEqual(enddate, datetime(2024, 1, 7))


def test_month_with_start_end_date(self):
startdate, enddate = dodge.dodge.get_start_end("month", "2024-01", "2024-02", {}, {})
startdate, enddate = dodge.get_start_end("month", "2024-01", "2024-02", {}, {})
self.assertEqual(startdate, datetime(2024, 1, 1))
self.assertEqual(enddate, datetime(2024, 2, 1))

Expand All @@ -86,28 +86,28 @@ def test_snp_dist_metric_no_missmatch(self):
a = "ACGTGTAC"
b = "ACGTGTAC"
args = argparse.Namespace(max_missmatch=3)
result = dodge.dodge.snp_dist_metric(a, b, args)
result = dodge.snp_dist_metric(a, b, args)
self.assertEqual(result, 0)

def test_snp_dist_metric_with_missmatch_within_threshold(self):
a = "ACGTCTAC"
b = "ACGTGTAC"
args = argparse.Namespace(max_missmatch=3)
result = dodge.dodge.snp_dist_metric(a, b, args)
result = dodge.snp_dist_metric(a, b, args)
self.assertEqual(result, 1)

def test_snp_dist_metric_with_missmatch_exceeding_threshold(self):
a = "ACGATACC"
b = "ACGTGTAC"
args = argparse.Namespace(max_missmatch=3)
result = dodge.dodge.snp_dist_metric(a, b, args)
result = dodge.snp_dist_metric(a, b, args)
self.assertEqual(result, 3) # Missmatch exceeds the threshold

def test_snp_dist_metric_with_missing_values(self):
a = "ACG-TACC"
b = "ACGTGNAC"
args = argparse.Namespace(max_missmatch=3)
result = dodge.dodge.snp_dist_metric(a, b, args)
result = dodge.snp_dist_metric(a, b, args)
self.assertEqual(result, 2)

class TestDodge_full(unittest.TestCase):
Expand Down Expand Up @@ -154,7 +154,7 @@ def test_with_dummy_week_investigation(self):
exclude_time_in_static = False,
usegenomes = False)

dodge.dodge.main(args)
dodge.main(args)

investclusters = args.outputPrefix + "_2017-01-29_2017-02-04_investigation_clusters.txt"

Expand Down Expand Up @@ -197,7 +197,7 @@ def test_with_dummy_month_investigation(self):
exclude_time_in_static = False,
usegenomes = False)

dodge.dodge.main(args)
dodge.main(args)

investclusters = args.outputPrefix + "_2017-05_investigation_clusters.txt"

Expand Down

0 comments on commit 5f8547a

Please sign in to comment.