We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
assertFilterErrors
assertFilterErrors output includes a lot of irrelevant output that makes it difficult to identify the cause of a test failure.
Example:
AssertionError: Filter generated unexpected error codes (expected {"trytes.0": ["empty"], "trytes.1": ["wrong_type"], "trytes.2": ["wrong_type"], "trytes.3": ["empty"], "trytes.4": ["not_trytes"], "trytes.6": ["wrong_type"], "trytes.7": ["wrong_format"]}): {'trytes.0': [FilterMessage('This value is required.', {'value': b'', 'filter': 'Required(allow_none=False)', 'key': 'trytes.0', 'replacement': None, 'code': 'empty'})], 'trytes.1': [FilterMessage('str is not valid (allowed types: TryteString, bytearray, bytes).', {'value': 'TRYTEVALUEHERE', 'filter': 'Type(TryteString, bytearray, bytes, allow_subclass=True)', 'key': 'trytes.1', 'replacement': None, 'code': 'wrong_type'})], 'trytes.2': [FilterMessage('bool is not valid (allowed types: TryteString, bytearray, bytes).', {'value': True, 'filter': 'Type(TryteString, bytearray, bytes, allow_subclass=True)', 'key': 'trytes.2', 'replacement': None, 'code': 'wrong_type'})], 'trytes.3': [FilterMessage('This value is required.', {'value': None, 'filter': 'Required(allow_none=False)', 'key': 'trytes.3', 'replacement': None, 'code': 'empty'})], 'trytes.4': [FilterMessage('This value is not a valid tryte sequence.', {'value': b'not valid trytes', 'filter': 'Trytes()', 'key': 'trytes.4', 'replacement': None, 'code': 'not_trytes'})], 'trytes.6': [FilterMessage('int is not valid (allowed types: TryteString, bytearray, bytes).', {'value': 2130706433, 'filter': 'Type(TryteString, bytearray, bytes, allow_subclass=True)', 'key': 'trytes.6', 'replacement': None, 'code': 'wrong_type'})]}
To make it easier to decipher the output, it would be helpful if irrelevant filter messages were removed from the result. E.g.:
AssertionError: Filter generated incorrect error codes: - [missing] 'trytes.6' - [unexpected] 'trytes.7': 'wrong_type' [FilterMessage('int is not valid (allowed types: TryteString, bytearray, bytes).', {'value': 2130706433, 'filter': 'Type(TryteString, bytearray, bytes, allow_subclass=True)', 'key': 'trytes.6', 'replacement': None, 'code': 'wrong_type'})]} - [wrong code]: 'trytes.8': 'wrong_type' (expected 'empty') [FilterMessage('int is not valid (allowed types: TryteString, bytearray, bytes).', {'value': 2130706433, 'filter': 'Type(TryteString, bytearray, bytes, allow_subclass=True)', 'key': 'trytes.6', 'replacement': None, 'code': 'wrong_type'})]}
Pretty-print the FilterMessage values, e.g.:
FilterMessage
- [wrong code]: 'trytes.8': 'wrong_type' (expected 'empty') [FilterMessage( message='int is not valid (allowed types: TryteString, bytearray, bytes).', context={'value': 2130706433, 'code': 'wrong_type', 'filter': 'Type(TryteString, bytearray, bytes, allow_subclass=True)', 'key': 'trytes.6', 'replacement': None})]}
The text was updated successfully, but these errors were encountered:
Need to consider how to format output when expected/actual contains multiple errors for a single key.
Sorry, something went wrong.
todofixthis
No branches or pull requests
assertFilterErrors
output includes a lot of irrelevant output that makes it difficult to identify the cause of a test failure.Example:
To make it easier to decipher the output, it would be helpful if irrelevant filter messages were removed from the result. E.g.:
Bonus Points
Pretty-print the
FilterMessage
values, e.g.:The text was updated successfully, but these errors were encountered: