def test_adjacent(self): assert bf._single_byte_hamming_distance((1, 0)) == 1
def test_example(self): assert bf._single_byte_hamming_distance((3, 16)) == 3
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
def test_symmetric(self, left, right): assert bf._single_byte_hamming_distance((left, right)) == \ bf._single_byte_hamming_distance((right, left))
def test_identical(self, arg): assert bf._single_byte_hamming_distance((arg, arg)) == 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))
def test_all_bits(self): assert bf._single_byte_hamming_distance((0, 255)) == 8