stphivos / django-mock-queries

A library for mocking django queryset functions in memory for testing
MIT License
319 stars 53 forks source link

Get error when using django cursor pagination #157

Open habibi1981 opened 2 years ago

habibi1981 commented 2 years ago

I'm using django cursor pagination for queryset pagination, and for testing my code I'm using the django-mock-queries package for mock queryset. I get this error when I get page two in queryset: python3.10/site-packages/django_mock_queries/utils.py:145: in is_match return {


  COMPARISON_LT: lambda: first < second if first is not None else False,

COMPARISON_LTE: lambda: first <= second if first is not None else False, COMPARISON_IN: lambda: first in second if first is not None else False, COMPARISON_STARTSWITH: lambda: first.startswith(second), COMPARISON_ISTARTSWITH: lambda: first.lower().startswith(second.lower()), COMPARISON_ENDSWITH: lambda: first.endswith(second), COMPARISON_IENDSWITH: lambda: first.lower().endswith(second.lower()), COMPARISON_ISNULL: lambda: (first is None) == bool(second), COMPARISON_REGEX: lambda: re.search(second, first) is not None, COMPARISON_IREGEX: lambda: re.search(second, first, flags=re.I) is not None, COMPARISON_RANGE: lambda: second[0] <= first <= second[1] }[comparison]() E TypeError: '<' not supported between instances of 'int' and 'Value'

stefan6419846 commented 1 year ago

Could you please provide a reproducing example?