Skip to content

Commit

Permalink
Fix test, address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
rbultman committed Jan 4, 2024
1 parent c77f68a commit 7de593c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
11 changes: 8 additions & 3 deletions src/python_testing/TC_DISHM_1_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
8 changes: 3 additions & 5 deletions src/python_testing/TC_DISHM_2_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7de593c

Please sign in to comment.