marsh.testing
¶
Tools that can be used for testing purposes.
- catch_cause(base=<class 'marsh.errors.MarshError'>, cause=None)[source]¶
Assert that an error is thrown in this context.
Similar to
pytest.raises()
but allows for inspecting and finding a specific cause for the error raised by traversing the __cause__ attribute chain.
- marshal_succeeds(value, element)[source]¶
Assert that a value can be marshaled.
The element is also compared to the expected output for the marshal.
- marshal_fails(value, exception=None)[source]¶
Assert that a value can not be marshaled.
Requires that marshaling of the input value raises
marsh.errors.MarshalError
.
- unmarshal_fails(type_, element, exception=None)[source]¶
Assert that a value can not be unmarshaled.
Requires that unmarshaling raises
marsh.errors.UnmarshalError
.- Parameters:
- Return type: