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).
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 whenignore_order=True
, which isn't possible with different data types.The same thing will probably happen for the query result data as well in a similar case (I didn't test that yet).
Example