Replacing six.iteritems() with .items()
We should avoid using six.iteritems to achieve
iterators. We can use dict.items instead, as it will return iterators
in PY3 as well. And dict.items/keys will be more readable.
For more information, please refer to [1][2].
[1] https://wiki.openstack.org/wiki/Python3#Common_patterns
[2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html
Change-Id: Ib1a5c6c4770d052d3e1c87eda037126442cb732c
rajat29 authored 6 years ago
ChangBo Guo(gcb) committed 6 years ago
37 | 37 | argdefs=six.get_function_defaults(original_func) |
38 | 38 | ) |
39 | 39 | |
40 | for key, val in six.iteritems(original_func.__dict__): | |
40 | for key, val in original_func.__dict__.items(): | |
41 | 41 | if key != 'build_data': |
42 | 42 | new_func.__dict__[key] = val |
43 | 43 | |
60 | 60 | to_remove = [] |
61 | 61 | to_add = [] |
62 | 62 | |
63 | for subtest_name, params in six.iteritems(build_data): | |
63 | for subtest_name, params in build_data.items(): | |
64 | 64 | # Build new test function |
65 | 65 | func_name = '{0}_{1}'.format(name, subtest_name) |
66 | 66 | new_func = construct_new_test_function(func_obj, func_name, params) |
82 | 82 | """ |
83 | 83 | tests_to_remove = [] |
84 | 84 | tests_to_add = [] |
85 | for key, val in six.iteritems(vars(cls)): | |
85 | for key, val in vars(cls).items(): | |
86 | 86 | # Only process tests with build data on them |
87 | 87 | if key.startswith('test_') and val.__dict__.get('build_data'): |
88 | 88 | to_remove, to_add = process_parameterized_function( |