33import hamming
44
55
6- # test cases adapted from `x-common //canonical-data.json` @ version: 1 .0.0
6+ # Tests adapted from `problem-specifications //canonical-data.json` @ v2 .0.1
77
88class HammingTest (unittest .TestCase ):
99
10+ def test_empty_strands (self ):
11+ self .assertEqual (hamming .distance ("" , "" ), 0 )
12+
1013 def test_identical_strands (self ):
1114 self .assertEqual (hamming .distance ("A" , "A" ), 0 )
1215
@@ -29,10 +32,10 @@ def test_small_distance_in_long_strands(self):
2932 self .assertEqual (hamming .distance ("ACCAGGG" , "ACTATGG" ), 2 )
3033
3134 def test_non_unique_character_in_first_strand (self ):
32- self .assertEqual (hamming .distance ("AGA " , "AGG " ), 1 )
35+ self .assertEqual (hamming .distance ("AAG " , "AAA " ), 1 )
3336
3437 def test_non_unique_character_in_second_strand (self ):
35- self .assertEqual (hamming .distance ("AGG " , "AGA " ), 1 )
38+ self .assertEqual (hamming .distance ("AAA " , "AAG " ), 1 )
3639
3740 def test_same_nucleotides_in_different_positions (self ):
3841 self .assertEqual (hamming .distance ("TAG" , "GAT" ), 2 )
@@ -43,9 +46,6 @@ def test_large_distance(self):
4346 def test_large_distance_in_off_by_one_strand (self ):
4447 self .assertEqual (hamming .distance ("GGACGGATTCTG" , "AGGACGGATTCT" ), 9 )
4548
46- def test_empty_strands (self ):
47- self .assertEqual (hamming .distance ("" , "" ), 0 )
48-
4949 def test_disallow_first_strand_longer (self ):
5050 with self .assertRaises (ValueError ):
5151 hamming .distance ("AATG" , "AAA" )
0 commit comments