Sha256: 9c5d10e94ceb966524b981d9b9bdf65dcefa8a50f851c6a6a1810af6a061d6df

Contents?: true

Size: 1.31 KB

Versions: 26

Compression:

Stored size: 1.31 KB

Contents

import unittest

from point_mutations import hamming_distance


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

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

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

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

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

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

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

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

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

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
trackler-2.0.3.0 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.0.2.0 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.0.1.2 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.0.1.1 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.0.1.0 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.0.0.10 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.0.0.9 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.0.0.8 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.0.0.7 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.0.0.6 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.0.0.5 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.0.0.4 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.0.0.3 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.0.0.2 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.0.0.1 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.0.0.0 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-1.0.4.1 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-1.0.4.0 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-1.0.3.0 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-1.0.2.1 tracks/python/exercises/point-mutations/point_mutations_test.py