我们从Python开源项目中,提取了以下3个代码示例,用于说明如何使用collections.abc.ByteString()。
def test_ByteString(self): for sample in [bytes, bytearray]: self.assertIsInstance(sample(), ByteString) self.assertTrue(issubclass(sample, ByteString)) for sample in [str, list, tuple]: self.assertNotIsInstance(sample(), ByteString) self.assertFalse(issubclass(sample, ByteString)) self.assertNotIsInstance(memoryview(b""), ByteString) self.assertFalse(issubclass(memoryview, ByteString))