def test_validate_not_bytes_from_str(self): with self.assertRaises(ValueError): util.validate_bytes(u'\x99\x99')
def test_validate_not_bytes(self): with self.assertRaises(ValueError): util.validate_bytes(str)
def test_validate_bytes_from_bytearray(self): ret = util.validate_bytes(b'\xaa\xbb') self.assertIsInstance(ret, bytes)