diff options
author | Trung Tran <trung.tran@ettus.com> | 2019-01-20 01:35:37 -0800 |
---|---|---|
committer | Brent Stapleton <brent.stapleton@ettus.com> | 2019-01-23 11:03:39 -0800 |
commit | c6618dd8d3daf986f40d0877231d106a5789d984 (patch) | |
tree | de3c50bd239cfa5f017aa378112f34ee80456d25 /host/tests/devtest/uhd_test_base.py | |
parent | ec2cad0346a7e459222d976a2cb4de34339aa3ae (diff) | |
download | uhd-c6618dd8d3daf986f40d0877231d106a5789d984.tar.gz uhd-c6618dd8d3daf986f40d0877231d106a5789d984.tar.bz2 uhd-c6618dd8d3daf986f40d0877231d106a5789d984.zip |
tests: replace has_key by using 'in'
python3+ dropped has_key function on dictionary. In order to make it
compatible, we need to use 'in' keyword.
Signed-off-by: Trung.Tran<trung.tran@ettus.com>
Diffstat (limited to 'host/tests/devtest/uhd_test_base.py')
-rwxr-xr-x | host/tests/devtest/uhd_test_base.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/host/tests/devtest/uhd_test_base.py b/host/tests/devtest/uhd_test_base.py index 57193e625..d77226941 100755 --- a/host/tests/devtest/uhd_test_base.py +++ b/host/tests/devtest/uhd_test_base.py @@ -153,7 +153,7 @@ class uhd_test_case(unittest.TestCase): """ Store a result as a key/value pair. After completion, all results for one test are written to the results file. """ - if not self.results[self.usrp_info['serial']][self.name].has_key(testname): + if not testname in self.results[self.usrp_info['serial']][self.name]: self.results[self.usrp_info['serial']][self.name][testname] = {} self.results[self.usrp_info['serial']][self.name][testname][key] = value @@ -214,13 +214,13 @@ class uhd_example_test_case(uhd_test_case): test_name, key, run_results[key] ) - if run_results.has_key('passed'): + if 'passed' in run_results: self.report_result( test_name, 'status', 'Passed' if run_results['passed'] else 'Failed', ) - if run_results.has_key('errors'): + if 'errors' in run_results: self.report_result( test_name, 'errors', @@ -234,7 +234,7 @@ class uhd_example_test_case(uhd_test_case): """ for test_name, test_args in iteritems(self.test_params): time.sleep(15) # Wait for X300 devices to reclaim them - if not test_args.has_key('products') \ + if not 'products' in test_args \ or (self.usrp_info['product'] in test_args.get('products', [])): run_results = self.run_test(test_name, test_args) passed = bool(run_results) |