Пример #1
0
 def matches(self, value):
     if self.hs is None or len(value.bytes) <= 1 or is_binary(value.bytes):
         return False
     try:
         return self.hs.spell(value.bytes.decode('utf-8'))
     except (UnicodeEncodeError, UnicodeDecodeError):
         return False
Пример #2
0
 def matches(self, value):
     if self.hs is None or len(value.bytes) <= 1 or is_binary(value.bytes):
         return False
     try:
         return self.hs.spell(value.bytes.decode('utf-8'))
     except (UnicodeEncodeError, UnicodeDecodeError):
         return False
Пример #3
0
def test_is_binary():
    assert is_binary(b'\0') is True
    assert is_binary(b'a') is False