[python] remove unnecessary calls to dict.keys() (#4576)

This commit is contained in:
Simon Lin
2020-02-18 10:16:06 -08:00
committed by GitHub
parent ef0cabafb1
commit c8dff09d3a
3 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -67,9 +67,9 @@ class Node:
def __init_sim(self, nodeid, mode):
""" Initialize a simulation node. """
if 'OT_CLI_PATH' in os.environ.keys():
if 'OT_CLI_PATH' in os.environ:
cmd = os.environ['OT_CLI_PATH']
elif 'top_builddir' in os.environ.keys():
elif 'top_builddir' in os.environ:
srcdir = os.environ['top_builddir']
cmd = '%s/examples/apps/cli/ot-cli-%s' % (srcdir, mode)
else:
@@ -102,12 +102,12 @@ class Node:
else:
args = ''
if 'OT_NCP_PATH' in os.environ.keys():
if 'OT_NCP_PATH' in os.environ:
cmd = 'spinel-cli.py -p "%s%s" -n' % (
os.environ['OT_NCP_PATH'],
args,
)
elif "top_builddir" in os.environ.keys():
elif "top_builddir" in os.environ:
builddir = os.environ['top_builddir']
cmd = 'spinel-cli.py -p "%s/examples/apps/ncp/ot-ncp-%s%s" -n' % (
builddir,
@@ -93,7 +93,7 @@ class TestRouteTable(unittest.TestCase):
for _node in self.nodes.values():
router_table = _node.router_table()
self.assertEqual(set(router_table.keys()), router_ids)
self.assertEqual(set(router_table), router_ids)
if __name__ == '__main__':
@@ -285,7 +285,7 @@ def discover(
continue
# skip cases
if case_name in log.keys():
if case_name in log:
if ((log[case_name]['passed'] and ('p' in skip)) or
(log[case_name]['passed'] is False and ('f' in skip)) or
(log[case_name]['passed'] is None and ('e' in skip))):