From 7de593c3fe75e567060def9e139d3868baecb0d3 Mon Sep 17 00:00:00 2001 From: Rob Bultman Date: Thu, 4 Jan 2024 14:50:11 -0500 Subject: [PATCH] Fix test, address comment --- src/python_testing/TC_DISHM_1_2.py | 11 ++++++++--- src/python_testing/TC_DISHM_2_1.py | 8 +++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/python_testing/TC_DISHM_1_2.py b/src/python_testing/TC_DISHM_1_2.py index 46e133e45fe244..12f1cc92103ca6 100644 --- a/src/python_testing/TC_DISHM_1_2.py +++ b/src/python_testing/TC_DISHM_1_2.py @@ -74,13 +74,18 @@ async def test_TC_DISHM_1_2(self): 0x8: 'Night', 0x9: 'Day'} - runTags = [tag.value for tag in Clusters.DishwasherMode.Enums.ModeTag - if tag is not Clusters.DishwasherMode.Enums.ModeTag.kUnknownEnumValue] + # kUnknownEnumValue may not be defined + try: + modeTags = [tag.value for tag in Clusters.DishwasherMode.Enums.ModeTag + if tag is not Clusters.DishwasherMode.Enums.ModeTag.kUnknownEnumValue] + except: + modeTags = Clusters.DishwasherMode.Enums.ModeTag for m in supported_modes: for t in m.modeTags: is_mfg = (0x8000 <= t.value and t.value <= 0xBFFF) - asserts.assert_true(t.value in commonTags.keys() or t.value in runTags or is_mfg, + asserts.assert_true(t.value <= 0xFFFF, "Tag value is > 16 bits") + asserts.assert_true(t.value in commonTags.keys() or t.value in modeTags or is_mfg, "Found a SupportedModes entry with invalid mode tag value!") asserts.assert_true(type(m.label) is str and len(m.label) in range(1, 65), diff --git a/src/python_testing/TC_DISHM_2_1.py b/src/python_testing/TC_DISHM_2_1.py index 5bc8093caba060..834c902d96f285 100644 --- a/src/python_testing/TC_DISHM_2_1.py +++ b/src/python_testing/TC_DISHM_2_1.py @@ -108,11 +108,9 @@ class CommonCodes(Enum): is_err_code = (st == CommonCodes.GENERIC_FAILURE.value) or (st == CommonCodes.INVALID_IN_MODE.value) or is_mfg_code asserts.assert_true( is_err_code, "Changing to mode %d must fail due to the current state of the device" % (self.modeFail)) - # Status text is an optional string which may not always be included - if ret.statusText: - logging.info("Status Text: %s" % (ret.statusText)) - st_text_len = len(ret.statusText) - asserts.assert_true(st_text_len in range(1, 65), "StatusText length (%d) must be between 1 and 64" % (st_text_len)) + logging.info("Status Text: %s" % (ret.statusText)) + st_text_len = len(ret.statusText) + asserts.assert_true(st_text_len in range(1, 65), "StatusText length (%d) must be between 1 and 64" % (st_text_len)) self.print_step(8, "Read CurrentMode attribute") current_mode = await self.read_mode_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode)