Skip to content

Commit

Permalink
Couple formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cecille committed Jun 26, 2023
1 parent 47632a6 commit e5935c3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/python_testing/TC_IDM_1_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def client_cmd(cmd_class):
# here incase we're inspecting a builtin class
try:
return cmd_class if cmd_class.is_client else None
except:
except AttributeError:
return None

# one of the steps in this test requires sending a command that requires a timed interaction
Expand Down Expand Up @@ -79,8 +79,8 @@ async def test_TC_IDM_1_2(self):

self.print_step(2, "Send Invoke to unsupported cluster")
all_cluster_ids = list(Clusters.ClusterObjects.ALL_CLUSTERS.keys())
unsupported_clusters: Dict[int, list[int]] = {}
supported_clusters: Dict[int, list[int]] = {}
unsupported_clusters: dict[int, list[int]] = {}
supported_clusters: dict[int, list[int]] = {}
for i in endpoints:
dut_ep_cluster_ids = wildcard_descriptor[i][Clusters.Descriptor][Clusters.Descriptor.Attributes.ServerList]
unsupported_clusters[i] = list(set(all_cluster_ids) - set(dut_ep_cluster_ids))
Expand All @@ -103,7 +103,7 @@ async def test_TC_IDM_1_2(self):
continue
# just use the first command with default values
name, cmd = members[0]
logging.info("Sending {} command to unsupported cluster {} on endpoint".format(name, cluster, i))
logging.info(f'Sending {name} command to unsupported cluster {cluster} on endpoint {i}')
try:
await self.default_controller.SendCommand(nodeid=self.dut_node_id, endpoint=i, payload=cmd())
asserts.fail("Unexpected success return from sending command to unsupported cluster")
Expand All @@ -124,7 +124,7 @@ async def test_TC_IDM_1_2(self):
break
for cid in supported_clusters[i]:
cluster = Clusters.ClusterObjects.ALL_CLUSTERS[cid]
logging.info('Checking cluster {} ({}) on ep {} for supported commands'.format(cluster, cid, i))
logging.info(f'Checking cluster {cluster} ({cid}) on ep {i} for supported commands')
members = get_all_cmds_for_cluster_id(cid)
if not members:
continue
Expand All @@ -141,7 +141,7 @@ async def test_TC_IDM_1_2(self):
cmd = next(filter(lambda x: x.command_id == id, all_supported_cmds))
try:
ret = await self.default_controller.SendCommand(nodeid=self.dut_node_id, endpoint=i, payload=cmd())
asserts.fail("Unexpected success sending unsupported cmd {} to {} cluster on ep {}".format(cmd, cluster, i))
asserts.fail(f'Unexpected success sending unsupported cmd {cmd} to {cluster} cluster on ep {i}')
except InteractionModelError as e:
asserts.assert_equal(e.status, Status.UnsupportedCommand, "Unexpected error returned from unsupported command")
sent = True
Expand Down Expand Up @@ -198,12 +198,12 @@ async def test_TC_IDM_1_2(self):
print(f'establishing pase session to {a}')
TH2.EstablishPASESessionIP(ipaddr=a, setupPinCode=pin, nodeid=self.dut_node_id+1)
break
except ChipStackError as e:
except ChipStackError:
continue

try:
TH2.GetConnectedDeviceSync(nodeid=self.dut_node_id+1, allowPASE=True, timeoutMs=1000)
except TimeoutError as e:
except TimeoutError:
asserts.fail("Unable to establish a PASE session to the device")

try:
Expand Down Expand Up @@ -247,7 +247,7 @@ async def test_TC_IDM_1_2(self):
# require a timed interaction (ArmFailSafe) and then one that does (RevokeCommissioning)
try:
await self.default_controller.TestOnlySendCommandTimedRequestFlagWithNoTimedInvoke(nodeid=self.dut_node_id, endpoint=0, payload=cmd)
asserts.fail("Unexpected success response from sendint an Invoke with TimedRequest flag and no timed interaction")
asserts.fail("Unexpected success response from sending an Invoke with TimedRequest flag and no timed interaction")
except InteractionModelError as e:
asserts.assert_equal(e.status, Status.UnsupportedAccess,
"Unexpected error response from Invoke with TimedRequest flag and no TimedInvoke")
Expand All @@ -259,7 +259,7 @@ async def test_TC_IDM_1_2(self):
cmd = FakeRevokeCommissioning()
try:
await self.default_controller.TestOnlySendCommandTimedRequestFlagWithNoTimedInvoke(nodeid=self.dut_node_id, endpoint=0, payload=cmd)
asserts.fail("Unexpected success response from sendint an Invoke with TimedRequest flag and no timed interaction")
asserts.fail("Unexpected success response from sending an Invoke with TimedRequest flag and no timed interaction")
except InteractionModelError as e:
asserts.assert_equal(e.status, Status.UnsupportedAccess,
"Unexpected error response from Invoke with TimedRequest flag and no TimedInvoke")
Expand Down

0 comments on commit e5935c3

Please sign in to comment.