Skip to content

Commit f80b10d

Browse files
committed
address code review comments
1 parent 1a8d6b2 commit f80b10d

File tree

1 file changed

+27
-24
lines changed

1 file changed

+27
-24
lines changed

src/python_testing/TC_TCTL_2_3.py

+27-24
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,13 @@ def pics_TC_TCTL_2_3(self):
5252
def steps_TC_TCTL_2_3(self) -> list[TestStep]:
5353
steps = [
5454
TestStep(1, "Commissioning, already done", is_commissioning=True),
55-
TestStep(2, "TH reads from the DUT the SelectedTemperatureLevel attribute"),
56-
TestStep(3, "TH reads from the DUT the SupportedTemperatureLevels attribute and verifies string lengths"),
55+
TestStep(2, "TH reads from the DUT the SelectedTemperatureLevel attribute",
56+
"Verify that the DUT response contains the value of _SelectedTemperatureLevel_ with a range of 0 to 31"),
57+
TestStep(3, "TH reads from the DUT the SupportedTemperatureLevels attribute and verifies string lengths",
58+
("Verify that the DUT response contains a _SupportedTemperatureLevels_ list\n\n"
59+
"* List length hast to be equal or less than 32 \n"
60+
"* Each temperature level should be a string\n"
61+
"* Length of each temperature level string should be equal or less than 16\n")),
5762
]
5863
return steps
5964

@@ -66,32 +71,30 @@ async def test_TC_TCTL_2_3(self):
6671

6772
# Step 2: Read SelectedTemperatureLevel attribute
6873
self.step(2)
69-
if self.attribute_guard(endpoint=self.endpoint, attribute=attributes.SelectedTemperatureLevel):
70-
selected_temp = await self.read_single_attribute_check_success(
71-
cluster=cluster,
72-
attribute=cluster.Attributes.SelectedTemperatureLevel
73-
)
74-
asserts.assert_true(0 <= selected_temp <= 31,
75-
f"SelectedTemperatureLevel {selected_temp} is out of range [0-31]")
74+
selected_temp = await self.read_single_attribute_check_success(
75+
cluster=cluster,
76+
attribute=attributes.SelectedTemperatureLevel
77+
)
78+
asserts.assert_true(0 <= selected_temp <= 31,
79+
f"SelectedTemperatureLevel {selected_temp} is out of range [0-31]")
7680

7781
# Step 3: Read SupportedTemperatureLevels attribute
7882
self.step(3)
79-
if self.attribute_guard(endpoint=self.endpoint, attribute=attributes.SupportedTemperatureLevels):
80-
supported_temps = await self.read_single_attribute_check_success(
81-
cluster=cluster,
82-
attribute=cluster.Attributes.SupportedTemperatureLevels
83-
)
84-
asserts.assert_true(isinstance(supported_temps, list),
85-
"SupportedTemperatureLevels should be a list")
86-
asserts.assert_true(len(supported_temps) <= 32,
87-
f"SupportedTemperatureLevels list length {len(supported_temps)} exceeds maximum of 32")
83+
supported_temps = await self.read_single_attribute_check_success(
84+
cluster=cluster,
85+
attribute=attributes.SupportedTemperatureLevels
86+
)
87+
asserts.assert_true(isinstance(supported_temps, list),
88+
"SupportedTemperatureLevels should be a list")
89+
asserts.assert_true(len(supported_temps) <= 32,
90+
f"SupportedTemperatureLevels list length {len(supported_temps)} exceeds maximum of 32")
8891

89-
# Verify string lengths
90-
for level in supported_temps:
91-
asserts.assert_true(isinstance(level, str),
92-
f"Temperature level {level} is not a string")
93-
asserts.assert_true(len(level) <= 16,
94-
f"Temperature level string '{level}' exceeds maximum length of 16")
92+
# Verify string lengths
93+
for level in supported_temps:
94+
asserts.assert_true(isinstance(level, str),
95+
f"Temperature level {level} is not a string")
96+
asserts.assert_true(len(level) <= 16,
97+
f"Temperature level string '{level}' exceeds maximum length of 16")
9598

9699

97100
if __name__ == "__main__":

0 commit comments

Comments
 (0)