Use instanceof instead of type
Adjusted conditional statements to use instanceof when comparing variables. Instanceof supports inheritance type checking better than type. Change-Id: I449f3df92b3646c384de717b7d53f7f85258c449
This commit is contained in:
parent
8155d453c8
commit
6b5e3d1faa
@ -42,7 +42,7 @@ class FakeClient(object):
|
||||
result = True
|
||||
try:
|
||||
for key, value in partial.items():
|
||||
if type(value) is dict:
|
||||
if isinstance(value, dict):
|
||||
result = self._dict_match(value, real[key])
|
||||
else:
|
||||
assert real[key] == value
|
||||
|
@ -140,7 +140,7 @@ def print_list(objs, fields, exclude_unavailable=False, formatters=None,
|
||||
field_name = field.replace(' ', '_')
|
||||
else:
|
||||
field_name = field.lower().replace(' ', '_')
|
||||
if type(o) == dict and field in o:
|
||||
if isinstance(o, dict) and field in o:
|
||||
data = o[field]
|
||||
else:
|
||||
if not hasattr(o, field_name) and exclude_unavailable:
|
||||
|
Loading…
x
Reference in New Issue
Block a user