def test_hamming_sphere_explicit(): assert list(hamming_sphere('', 0)) == [''] assert list(hamming_sphere('A', 0)) == ['A'] assert list(hamming_sphere('A', 1)) == ['C', 'G', 'T'] assert list(hamming_sphere('GTC', 0)) == ['GTC'] assert list(hamming_sphere('GTC', 1)) == [ 'ATC', 'CTC', 'TTC', 'GAC', 'GCC', 'GGC', 'GTA', 'GTG', 'GTT']
def test_hamming_sphere_explicit(): assert list(hamming_sphere('', 0)) == [''] assert list(hamming_sphere('A', 0)) == ['A'] assert list(hamming_sphere('A', 1)) == ['C', 'G', 'T'] assert list(hamming_sphere('GTC', 0)) == ['GTC'] assert list(hamming_sphere('GTC', 1)) == [ 'ATC', 'CTC', 'TTC', 'GAC', 'GCC', 'GGC', 'GTA', 'GTG', 'GTT' ]
def test_hamming_sphere(sk): s, k = sk result = list(hamming_sphere(s, k)) result_set = set(result) assert len(result) == len(result_set) assert len(result) == 3**k * binomial(len(s), k) for t in result: assert hamming_distance(s, t) == k
def test_hamming_sphere(sk): s, k = sk result = list(hamming_sphere(s, k)) result_set = set(result) assert len(result) == len(result_set) assert len(result) == 3 ** k * binomial(len(s), k) for t in result: assert hamming_distance(s, t) == k