Skip to content

Commit 11fbbbd

Browse files
committed
use write_single_attribute method instead of WriteAttribute, remove debug logging
1 parent 74fa074 commit 11fbbbd

File tree

1 file changed

+12
-22
lines changed

1 file changed

+12
-22
lines changed

src/python_testing/TC_FLABEL_2_1.py

+12-22
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,11 @@
3131
# quiet: true
3232
# === END CI TEST ARGUMENTS ===
3333

34-
import logging
3534
import chip.clusters as Clusters
3635
from chip.testing.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
3736
from chip.interaction_model import Status
3837
from mobly import asserts
3938

40-
logger = logging.getLogger(__name__)
41-
4239

4340
class Test_TC_FLABEL_2_1(MatterBaseTest):
4441
def pics_TC_FLABEL_2_1(self) -> list[str]:
@@ -64,36 +61,29 @@ async def test_TC_FLABEL_2_1(self):
6461
attribute=Clusters.Objects.FixedLabel.Attributes.LabelList
6562
)
6663
asserts.assert_true(isinstance(initial_labels, list), "LabelList should be a list type")
67-
logger.info(f"Initial LabelList: {initial_labels}")
6864

6965
# Step 3: Attempt to write LabelList (should fail)
7066
self.step(3)
71-
test_label = [Clusters.Objects.FixedLabel.Structs.LabelStruct(
72-
label="Test_Label",
73-
value="Test_Value"
74-
)]
75-
logger.info(f"Attempting to write LabelList: {test_label}")
67+
test_label = Clusters.Objects.FixedLabel.Attributes.LabelList(
68+
[Clusters.Objects.FixedLabel.Structs.LabelStruct(
69+
label="Test_Label",
70+
value="Test_Value"
71+
)]
72+
)
7673

77-
try:
78-
result = await self.default_controller.WriteAttribute(
79-
self.dut_node_id,
80-
[(1, Clusters.Objects.FixedLabel.Attributes.LabelList(test_label))]
81-
)
82-
logger.info(f"Write result: {result}")
83-
logger.info(f"Write status: {result[0]}")
84-
asserts.assert_equal(result[0].Status, Status.UnsupportedWrite, "Expected UNSUPPORTED_WRITE status")
85-
except Exception as e:
86-
logger.error(f"Unexpected error during write: {str(e)}")
87-
asserts.fail(f"Unexpected error during write: {str(e)}")
74+
# Use write_single_attribute with expect_success=False since we expect it to fail
75+
write_status = await self.write_single_attribute(
76+
attribute_value=test_label,
77+
expect_success=False
78+
)
79+
asserts.assert_equal(write_status, Status.UnsupportedWrite, "Expected UNSUPPORTED_WRITE status")
8880

8981
# Step 4: Verify LabelList hasn't changed
9082
self.step(4)
9183
final_labels = await self.read_single_attribute_check_success(
9284
cluster=Clusters.Objects.FixedLabel,
9385
attribute=Clusters.Objects.FixedLabel.Attributes.LabelList
9486
)
95-
logger.info(f"Final LabelList: {final_labels}")
96-
9787
asserts.assert_equal(initial_labels, final_labels,
9888
"LabelList should remain unchanged after write attempt")
9989

0 commit comments

Comments
 (0)