mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-03-16 08:06:05 +00:00
skip None and empty ([]) fields in proto messages
This commit is contained in:
parent
f587135b8d
commit
0c5eac2f39
@ -405,9 +405,8 @@ class DebugLinkMixin(object):
|
||||
"Expected %s, got %s" % (pprint(expected), pprint(msg)))
|
||||
|
||||
for field, value in expected.__dict__.items():
|
||||
if getattr(expected, field) is None:
|
||||
if value is None or value == []:
|
||||
continue
|
||||
print("EXPECTED", getattr(expected, field), getattr(msg, field), field, value)
|
||||
if getattr(msg, field) != value:
|
||||
raise CallException(proto.FailureType.UnexpectedMessage,
|
||||
"Expected %s, got %s" % (pprint(expected), pprint(msg)))
|
||||
|
@ -102,7 +102,12 @@ class MessageType:
|
||||
self.__dict__ == rhs.__dict__)
|
||||
|
||||
def __repr__(self):
|
||||
return '<%s: %s>' % (self.__class__.__name__, self.__dict__)
|
||||
d = {}
|
||||
for key, value in self.__dict__.items():
|
||||
if value is None or value == []:
|
||||
continue
|
||||
d[key] = value
|
||||
return '<%s: %s>' % (self.__class__.__name__, d)
|
||||
|
||||
def __iter__(self):
|
||||
return self.__dict__.__iter__()
|
||||
|
Loading…
Reference in New Issue
Block a user