mirror of
https://github.com/espressif/openthread.git
synced 2026-08-15 07:07:46 +00:00
[style] update python style to conform to PEP 8 (#3951)
With the exception of line length set to 119 vs. 79. Add tests/ and tools/ to py-pretty-check.
This commit is contained in:
@@ -40,6 +40,7 @@ ED1 = 17
|
||||
DUT_REED = 18
|
||||
ROUTER_SELECTION_JITTER = 1
|
||||
|
||||
|
||||
class Cert_5_2_5_AddressQuery(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.simulator = config.create_default_simulator()
|
||||
@@ -74,9 +75,9 @@ class Cert_5_2_5_AddressQuery(unittest.TestCase):
|
||||
self.nodes[DUT_REED].set_router_selection_jitter(1)
|
||||
|
||||
def tearDown(self):
|
||||
for node in list(self.nodes.values()):
|
||||
node.stop()
|
||||
node.destroy()
|
||||
for n in list(self.nodes.values()):
|
||||
n.stop()
|
||||
n.destroy()
|
||||
self.simulator.stop()
|
||||
|
||||
def test(self):
|
||||
@@ -123,8 +124,11 @@ class Cert_5_2_5_AddressQuery(unittest.TestCase):
|
||||
self.nodes[DUT_REED].add_whitelist(self.nodes[BR].get_addr64())
|
||||
self.nodes[BR].add_whitelist(self.nodes[DUT_REED].get_addr64())
|
||||
|
||||
# 6. Verify DUT_REED would send Address Notification when ping to its ML-EID.
|
||||
mleid = self.nodes[DUT_REED].get_ip6_address(config.ADDRESS_TYPE.ML_EID)
|
||||
# 6. Verify DUT_REED would send Address Notification when ping to its
|
||||
# ML-EID.
|
||||
mleid = self.nodes[DUT_REED].get_ip6_address(
|
||||
config.ADDRESS_TYPE.ML_EID
|
||||
)
|
||||
self.assertTrue(self.nodes[ED1].ping(mleid))
|
||||
|
||||
# Wait for sniffer collecting packets
|
||||
@@ -132,12 +136,17 @@ class Cert_5_2_5_AddressQuery(unittest.TestCase):
|
||||
|
||||
reed_messages = self.simulator.get_messages_sent_by(DUT_REED)
|
||||
msg = reed_messages.next_coap_message('0.02', '/a/an')
|
||||
command.check_address_notification(msg, self.nodes[DUT_REED], self.nodes[LEADER])
|
||||
command.check_address_notification(
|
||||
msg, self.nodes[DUT_REED], self.nodes[LEADER]
|
||||
)
|
||||
|
||||
# 7 & 8. Verify DUT_REED would send Address Notification when ping to its 2001::EID and 2002::EID.
|
||||
# 7 & 8. Verify DUT_REED would send Address Notification when ping to
|
||||
# its 2001::EID and 2002::EID.
|
||||
flag2001 = 0
|
||||
flag2002 = 0
|
||||
for global_address in self.nodes[DUT_REED].get_ip6_address(config.ADDRESS_TYPE.GLOBAL):
|
||||
for global_address in self.nodes[DUT_REED].get_ip6_address(
|
||||
config.ADDRESS_TYPE.GLOBAL
|
||||
):
|
||||
if global_address[0:4] == '2001':
|
||||
flag2001 += 1
|
||||
elif global_address[0:4] == '2002':
|
||||
@@ -151,10 +160,13 @@ class Cert_5_2_5_AddressQuery(unittest.TestCase):
|
||||
|
||||
reed_messages = self.simulator.get_messages_sent_by(DUT_REED)
|
||||
msg = reed_messages.next_coap_message('0.02', '/a/an')
|
||||
command.check_address_notification(msg, self.nodes[DUT_REED], self.nodes[LEADER])
|
||||
command.check_address_notification(
|
||||
msg, self.nodes[DUT_REED], self.nodes[LEADER]
|
||||
)
|
||||
|
||||
assert flag2001 == 1, "Error: Expecting address 2001::EID not appear."
|
||||
assert flag2002 == 1, "Error: Expecting address 2002::EID not appear."
|
||||
|
||||
assert flag2001 == 1 , "Error: Expecting address 2001::EID not appear."
|
||||
assert flag2002 == 1 , "Error: Expecting address 2002::EID not appear."
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user