def test_loads(self): msg = ConnectMsg.loads(b'\x00\x00\x00\x15\x01'+self.uuid.bytes) self.assertEqual(self.uuid, msg.clientid)
def test_loads_unknown_kind(self): with self.assertRaisesRegex(ValueError, 'Unknown msg kind 254'): ConnectMsg.loads(b'\x00\x00\x00\x11\xfe'+self.uuid.bytes)
def test_loads_unknown_kind(self): with self.assertRaisesRegex(ValueError, 'Unknown msg kind 254'): ConnectMsg.loads(b'\x00\x00\x00\x11\xfe' + self.uuid.bytes)
def test_dumps(self): msg = ConnectMsg(self.uuid) self.assertEqual(b'\x00\x00\x00\x15\x01'+self.uuid.bytes, msg.dumps())
def test_dumps(self): msg = ConnectMsg(self.uuid) self.assertEqual(b'\x00\x00\x00\x15\x01' + self.uuid.bytes, msg.dumps())
def test_loads(self): msg = ConnectMsg.loads(b'\x00\x00\x00\x15\x01' + self.uuid.bytes) self.assertEqual(self.uuid, msg.clientid)
def test_ctor_invalid_arg_type(self): with self.assertRaisesRegex(TypeError, 'invalid value type'): ConnectMsg(1)
def test_ctor_invalid_arg_name(self): with self.assertRaisesRegex(TypeError, 'parameter lacking default value'): ConnectMsg(uuid=self.uuid)
def test_ctor_extra_arg(self): with self.assertRaisesRegex(TypeError, 'too many positional arguments'): ConnectMsg(1, 2)
def test_ctor_missing_arg(self): with self.assertRaisesRegex(TypeError, 'parameter lacking default value'): ConnectMsg()
def test_ctor(self): msg = ConnectMsg(self.uuid) self.assertEqual(self.uuid, msg.clientid)