Skip to content

Commit

Permalink
Fixed some attribute access errors and improved the logic following t…
Browse files Browse the repository at this point in the history
…he new lanmark structure. (#34908)
  • Loading branch information
hicklin authored and pull[bot] committed Aug 27, 2024
1 parent 56bfe35 commit 1610610
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/python_testing/TC_SEAR_1_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async def read_and_validate_supported_maps(self, step):
self.print_step(step, "Read SupportedMaps attribute")
supported_maps = await self.read_sear_attribute_expect_success(
endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.SupportedMaps)
logging.info("SupportedMaps: %s" % (supported_maps))
logging.info("SupportedMaps: %s" % supported_maps)
asserts.assert_less_equal(len(supported_maps), 255,
"SupportedMaps should have max 255 entries")

Expand All @@ -69,14 +69,14 @@ async def read_and_validate_supported_maps(self, step):
name_list = [m.name for m in supported_maps]
asserts.assert_true(len(set(name_list)) == len(name_list), "SupportedMaps must have unique Name values!")

# save so other methods can use this if neeeded
# save so other methods can use this if needed
self.mapid_list = mapid_list

async def read_and_validate_supported_areas(self, step):
self.print_step(step, "Read SupportedAreas attribute")
supported_areas = await self.read_sear_attribute_expect_success(
endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.SupportedAreas)
logging.info("SupportedAreas: %s" % (supported_areas))
logging.info("SupportedAreas: %s" % supported_areas)
asserts.assert_less_equal(len(supported_areas), 255,
"SupportedAreas should have max 255 entries")
areaid_list = []
Expand All @@ -103,15 +103,16 @@ async def read_and_validate_supported_areas(self, step):
asserts.assert_true(k not in areadesc_s, f"SupportedAreas must have unique AreaDesc({a.areaDesc}) values!")
areadesc_s.add(k)

if a.locationInfo is NullValue and a.landmarkTag is NullValue:
if a.areaDesc.locationInfo is NullValue and a.areaDesc.landmarkInfo is NullValue:
asserts.assert_true(
f"SupportedAreas entry with AreaID({a.areaID}) should not have null LocationInfo and null LandmarkTag")
if a.landmarkTag is not NullValue:
asserts.assert_true(a.landmarkTag <= self.MAX_LANDMARK_ID,
f"SupportedAreas entry with AreaID({a.areaID}) has invalid LandmarkTag({a.landmarkTag})")
asserts.assert_true(a.positionTag is NullValue or a.positionTag in range(0, self.MAX_RELPOS_ID),
f"SupportedAreas entry with AreaID({a.areaID}) has invalid PositionTag({a.positionTag})")
# save so other methods can use this if neeeded
f"SupportedAreas entry with AreaID({a.areaID}) should not have null LocationInfo and null LandmarkInfo")
if a.areaDesc.landmarkInfo is not NullValue:
asserts.assert_true(a.areaDesc.landmarkInfo.landmarkTag <= self.MAX_LANDMARK_ID,
f"SupportedAreas entry with AreaID({a.areaID}) has invalid LandmarkTag({a.areaDesc.landmarkInfo.landmarkTag})")
asserts.assert_true(a.areaDesc.landmarkInfo.positionTag is NullValue or a
.areaDesc.landmarkInfo.positionTag in range(0, self.MAX_RELPOS_ID),
f"SupportedAreas entry with AreaID({a.areaID}) has invalid PositionTag({a.areaDesc.landmarkInfo.positionTag})")
# save so other methods can use this if needed
self.areaid_list = areaid_list

async def read_and_validate_selected_areas(self, step):
Expand All @@ -130,7 +131,7 @@ async def read_and_validate_selected_areas(self, step):
for a in selected_areas:
asserts.assert_true(a in self.areaid_list,
f"SelectedAreas entry {a} has invalid value")
# save so other methods can use this if neeeded
# save so other methods can use this if needed
self.selareaid_list = selected_areas

async def read_and_validate_current_area(self, step):
Expand All @@ -143,7 +144,7 @@ async def read_and_validate_current_area(self, step):
or
current_area in self.selareaid_list,
f"CurrentArea {current_area} is invalid. SelectedAreas is {self.selareaid_list}.")
# save so other methods can use this if neeeded
# save so other methods can use this if needed
self.current_area = current_area

async def read_and_validate_estimated_end_time(self, step):
Expand Down

0 comments on commit 1610610

Please sign in to comment.