Skip to content

Commit f45c3e7

Browse files
committed
TC-CLCTRL-4.3 increase readability in block 8
1 parent 7c4b955 commit f45c3e7

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

src/python_testing/TC_CLCTRL_4_3.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def steps_TC_CLCTRL_4_3(self) -> list[TestStep]:
157157
"Receive CONSTRAINT_ERROR response from the DUT"),
158158
TestStep("7d", "If the SP feature is supported, send MoveTo command with Position = MoveToFullyClosed and Speed = 4",
159159
"Receive CONSTRAINT_ERROR response from the DUT"),
160-
TestStep("8a", "Check LT feature support", "Skip steps 8b to 8h if the LT feature is not supported"),
160+
TestStep("8a", "Check LT feature support", "Skip steps 8b to 8j if the LT feature is not supported"),
161161
TestStep("8b", "Read the OverallCurrentState attribute",
162162
"OverallCurrentState of the ClosureControl cluster is returned by the DUT; Latching field is saved as CurrentLatch"),
163163
TestStep("8c", "Preparing Latch-State: If CurrentLatch is True and LatchControlModes Bit 0 = 1, skip step 8d"),
@@ -166,9 +166,12 @@ def steps_TC_CLCTRL_4_3(self) -> list[TestStep]:
166166
TestStep("8e", "If CurrentLatch is False and LatchControlModes Bit 1 = 1, skip step 8f"),
167167
TestStep("8f", "Send MoveTo command with Latch = CurrentLatch",
168168
"Receive INVALID_IN_STATE response from the DUT"),
169-
TestStep("8g", "If LatchControlModes Bit 1 = 0 or LatchControlModes Bit 0 = 0, skip step 8h"),
169+
TestStep("8g", "If CurrentLatch is True and LatchControlModes Bit 0 = 0, skip step 8h"),
170170
TestStep("8h", "Send MoveTo command with Latch = CurrentLatch",
171171
"Receive SUCCESS response from the DUT"),
172+
TestStep("8i", "If CurrentLatch is False and LatchControlModes Bit 1 = 0, skip step 8j"),
173+
TestStep("8j", "Send MoveTo command with Latch = CurrentLatch",
174+
"Receive SUCCESS response from the DUT"),
172175
TestStep("9a", "Check PS feature support", "Skip steps 9b and 9c if the PS feature is not supported"),
173176
TestStep("9b", "Read the OverallCurrentState attribute",
174177
"OverallCurrentState of the ClosureControl cluster is returned by the DUT; Position field is saved as CurrentPosition"),
@@ -547,7 +550,7 @@ async def test_TC_CLCTRL_4_3(self):
547550
f"Expected InvalidInState status for MoveTo with Latch = {current_latch}, but got: {e}")
548551

549552
self.step("8g")
550-
if not latch_control_modes & Clusters.ClosureControl.Bitmaps.LatchControlModesBitmap.kRemoteUnlatching or not latch_control_modes & Clusters.ClosureControl.Bitmaps.LatchControlModesBitmap.kRemoteLatching:
553+
if current_latch and not (latch_control_modes & Clusters.ClosureControl.Bitmaps.LatchControlModesBitmap.kRemoteLatching):
551554
self.skip_step("8h")
552555
else:
553556
self.step("8h")
@@ -558,11 +561,24 @@ async def test_TC_CLCTRL_4_3(self):
558561
logging.error(f"MoveTo command with Latch = {current_latch} failed: {e}")
559562
asserts.assert_equal(e.status, Status.Success,
560563
f"Expected Success status for MoveTo with Latch = {current_latch}, but got: {e}")
564+
565+
self.step("8i")
566+
if not current_latch and not (latch_control_modes & Clusters.ClosureControl.Bitmaps.LatchControlModesBitmap.kRemoteUnlatching):
567+
self.skip_step("8j")
568+
else:
569+
self.step("8j")
570+
try:
571+
await self.send_single_cmd(endpoint=endpoint, cmd=Clusters.ClosureControl.Commands.MoveTo(latch=current_latch), timedRequestTimeoutMs=1000)
572+
logging.info(f"MoveTo command with Latch = {current_latch} sent successfully")
573+
except InteractionModelError as e:
574+
logging.error(f"MoveTo command with Latch = {current_latch} failed: {e}")
575+
asserts.assert_equal(e.status, Status.Success,
576+
f"Expected Success status for MoveTo with Latch = {current_latch}, but got: {e}")
561577
sub_handler.reset()
562578

563579
else:
564-
logging.info("Skipping steps 8b to 8h as Latching feature is not supported")
565-
self.mark_step_range_skipped("8b", "8h")
580+
logging.info("Skipping steps 8b to 8j as Latching feature is not supported")
581+
self.mark_step_range_skipped("8b", "8j")
566582

567583
self.step("9a")
568584
if is_position_supported:

0 commit comments

Comments
 (0)