def test_malformed_swarm_identifier(self): with self.assertRaises(ValueError): protocol_options.decode_swarm_id(memoryview(b'\x00\x10\x00'), 0, ...)
def test_malformed_swarm_identifier(self): with self.assertRaises(ValueError): protocol_options.decode_swarm_id( memoryview(b'\x00\x10\x00'), 0, ...)
def test_swarm_identifier(self, data): value, _ = protocol_options.decode_swarm_id(memoryview(data), 0, ...) self.assertIsInstance(value, bytes) result = protocol_options.encode_swarm_id(value, ...) self.assertEqual(data, result)
def test_swarm_identifier(self, data): value, _ = protocol_options.decode_swarm_id( memoryview(data), 0, ...) self.assertIsInstance(value, bytes) result = protocol_options.encode_swarm_id(value, ...) self.assertEqual(data, result)