Exemplo n.º 1
0
 def test_adjacent(self):
     assert bf._single_byte_hamming_distance((1, 0)) == 1
Exemplo n.º 2
0
 def test_example(self):
     assert bf._single_byte_hamming_distance((3, 16)) == 3
Exemplo n.º 3
0
 def test_subadditive(self, arg1, arg2, arg3):
     dist12 = bf._single_byte_hamming_distance((arg1, arg2))
     dist23 = bf._single_byte_hamming_distance((arg2, arg3))
     dist13 = bf._single_byte_hamming_distance((arg1, arg3))
     assert dist13 <= dist12 + dist23
Exemplo n.º 4
0
 def test_symmetric(self, left, right):
     assert bf._single_byte_hamming_distance((left, right)) == \
            bf._single_byte_hamming_distance((right, left))
Exemplo n.º 5
0
 def test_identical(self, arg):
     assert bf._single_byte_hamming_distance((arg, arg)) == 0
Exemplo n.º 6
0
 def test_range(self, byte, non_byte):
     with pytest.raises(ValueError):
         bf._single_byte_hamming_distance((byte, non_byte))
     with pytest.raises(ValueError):
         bf._single_byte_hamming_distance((non_byte, byte))
Exemplo n.º 7
0
 def test_all_bits(self):
     assert bf._single_byte_hamming_distance((0, 255)) == 8