Sha256: 7506349cf2fc88bad51ec6dd5286d258632c3ee595b42dc37c3ac1872c705749

Contents?: true

Size: 1.26 KB

Versions: 250

Compression:

Stored size: 1.26 KB

Contents

import unittest

from point_mutations import hamming_distance


class DNATest(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

250 entries across 250 versions & 1 rubygems

Version Path
trackler-2.2.1.160 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.159 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.158 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.157 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.156 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.155 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.154 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.153 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.152 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.151 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.150 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.149 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.148 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.147 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.146 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.145 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.144 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.143 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.142 tracks/python/exercises/point-mutations/point_mutations_test.py
trackler-2.2.1.141 tracks/python/exercises/point-mutations/point_mutations_test.py