Sha256: bc9642dd76a5b826c639fd36273bf11df5224194588b01b29b82667e4f30ae88

Contents?: true

Size: 1.27 KB

Versions: 19

Compression:

Stored size: 1.27 KB

Contents

import unittest

from point_mutations import hamming_distance


class PointMutationsTest(unittest.TestCase):
    def test_no_difference_between_empty_strands(self):
        self.assertEqual(hamming_distance('', ''), 0)

    def test_no_difference_between_identical_strands(self):
        self.assertEqual(hamming_distance('GGACTGA', 'GGACTGA'), 0)

    def test_complete_hamming_distance_in_small_strand(self):
        self.assertEqual(hamming_distance('ACT', 'GGA'), 3)

    def test_hamming_distance_in_off_by_one_strand(self):
        self.assertEqual(
            hamming_distance('GGACGGATTCTGACCTGGACTAATTTTGGGG',
                             'AGGACGGATTCTGACCTGGACTAATTTTGGGG'), 19)

    def test_small_hamming_distance_in_middle_somewhere(self):
        self.assertEqual(hamming_distance('GGACG', 'GGTCG'), 1)

    def test_larger_distance(self):
        self.assertEqual(hamming_distance('ACCAGGG', 'ACTATGG'), 2)

    def test_ignores_extra_length_on_other_strand_when_longer(self):
        self.assertEqual(hamming_distance('AAACTAGGGG', 'AGGCTAGCGGTAGGAC'), 3)

    def test_ignores_extra_length_on_original_strand_when_longer(self):
        self.assertEqual(
            hamming_distance('GACTACGGACAGGGTAGGGAAT', 'GACATCGCACACC'), 5)


if __name__ == '__main__':
    unittest.main()

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.179 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.178 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.177 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.176 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.175 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.174 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.173 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.172 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.171 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.170 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.169 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.167 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.166 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.165 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.164 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.163 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.162 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.161 tracks/python/exercises/point-mutations/point_mutations_test.py