def test_assign_code(self): """Test assigning a specific code to a Status.""" status = Status('Success', 'A test status', range(0x0000, 0x0000 + 2)) status.code = 0x0001 self.assertEqual(status.code, 0x0001) with self.assertRaises(ValueError): status.code = 0x0002 with self.assertRaises(TypeError): status.code = 'a'
def test_int(self): """Test the Status __int__ method.""" status = Status('Success', 'A test status', range(0x0000, 0x0000 + 2)) # Test default code self.assertEqual(int(status), 0x0000) status.code = 0x0001 # Test assigned code self.assertEqual(int(status), 0x0001)