class ModelInfoTest(unittest.TestCase): def setUp(self): super().setUp() self.model_info = ModelInfo(DATA) def test_value_enum(self): actual = self.model_info.value("AntiBacterial") expected = EnumValue({"0": "@CP_OFF_EN_W", "1": "@CP_ON_EN_W"}) self.assertEqual(expected, actual) def test_value_range(self): actual = self.model_info.value("Initial_Time_H") expected = RangeValue(min=0, max=24, step=1) self.assertEqual(expected, actual) def test_value_bit(self): actual = self.model_info.value("Option1") expected = BitValue({ 0: "ChildLock", 1: "ReduceStatic", 2: "EasyIron", 3: "DampDrySingal", 4: "WrinkleCare", 7: "AntiBacterial", }) self.assertEqual(expected, actual) def test_value_reference(self): actual = self.model_info.value("Course") expected = ReferenceValue(DATA["Course"]) self.assertEqual(expected, actual) def test_string(self): actual = self.model_info.value("TimeBsOn") expected = StringValue( "오전 12시 30분은 0030, 오후12시30분은 1230 ,오후 4시30분은 1630 off는 0 ") self.assertEqual(expected, actual) def test_value_unsupported(self): data = "{'type': 'Unexpected'}" with self.assertRaisesRegex( ValueError, f"unsupported value name: 'Unexpected' type: 'Unexpected' " f"data: '{data}'", ): self.model_info.value("Unexpected") def test_value_unsupported_but_data_available(self): data = "{'type': 'Unexpected', 'option': 'some option'}" with self.assertRaisesRegex( ValueError, f"unsupported value name: 'Unexpected2'" f" type: 'Unexpected' data: '{data}", ): self.model_info.value("Unexpected2")
class ModelInfoTest(unittest.TestCase): def setUp(self): super().setUp() self.model_info = ModelInfo(DATA) def test_value_enum(self): actual = self.model_info.value('AntiBacterial') expected = EnumValue({'0': '@CP_OFF_EN_W', '1': '@CP_ON_EN_W'}) self.assertEqual(expected, actual) def test_value_range(self): actual = self.model_info.value('Initial_Time_H') expected = RangeValue(min=0, max=24, step=1) self.assertEqual(expected, actual) def test_value_bit(self): actual = self.model_info.value('Option1') expected = BitValue({ 0: 'ChildLock', 1: 'ReduceStatic', 2: 'EasyIron', 3: 'DampDrySingal', 4: 'WrinkleCare', 7: 'AntiBacterial', }) self.assertEqual(expected, actual) def test_value_reference(self): actual = self.model_info.value('Course') expected = ReferenceValue(DATA['Course']) self.assertEqual(expected, actual) def test_string(self): actual = self.model_info.value('TimeBsOn') expected = StringValue( "오전 12시 30분은 0030, 오후12시30분은 1230 ,오후 4시30분은 1630 off는 0 ") self.assertEqual(expected, actual) def test_value_unsupported(self): data = "{'type': 'Unexpected'}" with self.assertRaisesRegex( ValueError, f"unsupported value name: 'Unexpected' type: 'Unexpected' " f"data: '{data}'"): self.model_info.value('Unexpected') def test_value_unsupported_but_data_available(self): data = "{'type': 'Unexpected', 'option': 'some option'}" with self.assertRaisesRegex( ValueError, f"unsupported value name: 'Unexpected2'" f" type: 'Unexpected' data: '{data}"): self.model_info.value('Unexpected2')
class ModelInfoTest(unittest.TestCase): def setUp(self): super().setUp() self.model_info = ModelInfo(DATA) def test_value_enum(self): actual = self.model_info.value('AntiBacterial') expected = EnumValue({'0': '@CP_OFF_EN_W', '1': '@CP_ON_EN_W'}) self.assertEqual(expected, actual) def test_value_range(self): actual = self.model_info.value('Initial_Time_H') expected = RangeValue(min=0, max=24, step=1) self.assertEqual(expected, actual) def test_value_bit(self): actual = self.model_info.value('Option1') expected = BitValue({ 0: 'ChildLock', 1: 'ReduceStatic', 2: 'EasyIron', 3: 'DampDrySingal', 4: 'WrinkleCare', 7: 'AntiBacterial', }) self.assertEqual(expected, actual) def test_value_reference(self): actual = self.model_info.value('Course') expected = ReferenceValue(DATA['Course']) self.assertEqual(expected, actual) def test_value_unsupported(self): with self.assertRaisesRegex( ValueError, 'unsupported value type Unexpected'): self.model_info.value('Unexpected')
def setUp(self): super().setUp() self.model_info = ModelInfo(DATA)