|
45 | 45 |
|
46 | 46 | class TC_BINFO_3_1(MatterBaseTest): |
47 | 47 | async def read_binfo_attribute_expect_success(self, endpoint, attribute): |
| 48 | + """Read a Basic Information cluster attribute and verify the read succeeds. |
| 49 | +
|
| 50 | + Args: |
| 51 | + endpoint: The endpoint ID to read the attribute from. |
| 52 | + attribute: The Basic Information cluster attribute to read. |
| 53 | +
|
| 54 | + Returns: |
| 55 | + The attribute value read from the device. |
| 56 | + """ |
48 | 57 | cluster = Clusters.Objects.BasicInformation |
49 | 58 | return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) |
50 | 59 |
|
@@ -78,47 +87,54 @@ def pics_TC_BINFO_3_1(self) -> list[str]: |
78 | 87 | ] |
79 | 88 | return pics |
80 | 89 |
|
| 90 | + @async_test_body |
| 91 | + async def setup_test(self): |
| 92 | + """Validate required PIXIT parameters before test execution.""" |
| 93 | + asserts.assert_true("PIXIT.BINFO.Finish" in self.matter_test_config.global_test_params, |
| 94 | + "PIXIT.BINFO.Finish must be included on the command line in " |
| 95 | + "the --int-arg flag as PIXIT.BINFO.Finish:<finish_value>") |
| 96 | + self.pixit_finish = self.matter_test_config.global_test_params["PIXIT.BINFO.Finish"] |
| 97 | + |
| 98 | + asserts.assert_true("PIXIT.BINFO.PrimaryColor" in self.matter_test_config.global_test_params, |
| 99 | + "PIXIT.BINFO.PrimaryColor must be included on the command line in " |
| 100 | + "the --int-arg flag as PIXIT.BINFO.PrimaryColor:<primary_color_value>") |
| 101 | + self.pixit_primary_color = self.matter_test_config.global_test_params["PIXIT.BINFO.PrimaryColor"] |
| 102 | + |
| 103 | + await super().setup_test() |
| 104 | + |
81 | 105 | @async_test_body |
82 | 106 | async def test_TC_BINFO_3_1(self): |
83 | 107 |
|
84 | 108 | endpoint = self.get_endpoint(default=0) |
85 | 109 | attributes = Clusters.BasicInformation.Attributes |
86 | 110 |
|
87 | 111 | # Read ProductAppearance once and reuse for all steps since the attribute value doesn't change |
88 | | - productAppearance = await self.read_binfo_attribute_expect_success( |
| 112 | + product_appearance = await self.read_binfo_attribute_expect_success( |
89 | 113 | endpoint=endpoint, attribute=attributes.ProductAppearance) |
90 | | - asserts.assert_is_not_none(productAppearance, "ProductAppearance attribute read failed") |
| 114 | + asserts.assert_is_not_none(product_appearance, "ProductAppearance attribute read failed") |
91 | 115 |
|
92 | 116 | self.step(1) |
93 | | - asserts.assert_greater_equal(productAppearance.finish, 0, "Finish value is below minimum range") |
94 | | - asserts.assert_less_equal(productAppearance.finish, 5, "Finish value is above maximum range") |
| 117 | + asserts.assert_greater_equal(product_appearance.finish, 0, "Finish value is below minimum range") |
| 118 | + asserts.assert_less_equal(product_appearance.finish, 5, "Finish value is above maximum range") |
95 | 119 |
|
96 | 120 | self.step(2) |
97 | | - asserts.assert_greater_equal(productAppearance.primaryColor, 0, "PrimaryColor value is below minimum range") |
98 | | - asserts.assert_less_equal(productAppearance.primaryColor, 20, "PrimaryColor value is above maximum range") |
| 121 | + asserts.assert_greater_equal(product_appearance.primaryColor, 0, "PrimaryColor value is below minimum range") |
| 122 | + asserts.assert_less_equal(product_appearance.primaryColor, 20, "PrimaryColor value is above maximum range") |
99 | 123 |
|
100 | 124 | self.step(3) |
101 | 125 | # Vendor specific test: This step should verify the actual Finish value matches PIXIT.BINFO.Finish |
102 | 126 | # For example, if PIXIT.BINFO.Finish is satin(2), the test should verify finish == 2 |
103 | | - asserts.assert_true("PIXIT.BINFO.Finish" in self.matter_test_config.global_test_params, |
104 | | - "PIXIT.BINFO.Finish must be included on the command line in " |
105 | | - "the --int-arg flag as PIXIT.BINFO.Finish:<finish_value>") |
106 | | - pixit_finish = self.matter_test_config.global_test_params["PIXIT.BINFO.Finish"] |
107 | | - asserts.assert_equal(productAppearance.finish, pixit_finish, |
108 | | - (f"ProductAppearance.Finish ({productAppearance.finish}) " |
109 | | - f"does not match PIXIT.BINFO.Finish ({pixit_finish})\n" |
| 127 | + asserts.assert_equal(product_appearance.finish, self.pixit_finish, |
| 128 | + (f"ProductAppearance.Finish ({product_appearance.finish}) " |
| 129 | + f"does not match PIXIT.BINFO.Finish ({self.pixit_finish})\n" |
110 | 130 | "Please verify the PIXIT.BINFO.Finish setting and try again.")) |
111 | 131 |
|
112 | 132 | self.step(4) |
113 | 133 | # Vendor specific test: This step should verify the actual PrimaryColor value matches PIXIT.BINFO.PrimaryColor |
114 | 134 | # For example, if PIXIT.BINFO.PrimaryColor is purple(5), the test should verify primaryColor == 5 |
115 | | - asserts.assert_true("PIXIT.BINFO.PrimaryColor" in self.matter_test_config.global_test_params, |
116 | | - "PIXIT.BINFO.PrimaryColor must be included on the command line in " |
117 | | - "the --int-arg flag as PIXIT.BINFO.PrimaryColor:<primary_color_value>") |
118 | | - pixit_primary_color = self.matter_test_config.global_test_params["PIXIT.BINFO.PrimaryColor"] |
119 | | - asserts.assert_equal(productAppearance.primaryColor, pixit_primary_color, |
120 | | - (f"ProductAppearance.PrimaryColor ({productAppearance.primaryColor})\n" |
121 | | - f"does not match PIXIT.BINFO.PrimaryColor ({pixit_primary_color})\n" |
| 135 | + asserts.assert_equal(product_appearance.primaryColor, self.pixit_primary_color, |
| 136 | + (f"ProductAppearance.PrimaryColor ({product_appearance.primaryColor}) " |
| 137 | + f"does not match PIXIT.BINFO.PrimaryColor ({self.pixit_primary_color})\n" |
122 | 138 | "Please verify the PIXIT.BINFO.PrimaryColor setting and try again.")) |
123 | 139 |
|
124 | 140 |
|
|
0 commit comments