-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Problem
When calling BaseMockTable.assert_equal with expected data that contains both None values and not-None values for the same key an Exception can be raised. It's caused by sorting of the list when ignore_order=True, which isn't possible with different data types.
.../sql_mock/table_mocks.py:315: in assert_equal
self._assert_equal(
.../sql_mock/table_mocks.py:259: in _assert_equal
> expected = sorted(expected, key=lambda d: sorted(d.items()))
E TypeError: '<' not supported between instances of 'str' and 'NoneType'
.../sql_mock/table_mocks.py:259: TypeError
The same thing will probably happen for the query result data as well in a similar case (I didn't test that yet).
Example
expected_output = [{'foo': 'bar'}, {'foo': None}]
mock_table.assert_equal(expected) # raises TypeError (see above)
Somtom
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working