Skip to content

Commit

Permalink
LITE-30338: Adding new search patterns that are now supported by lib-…
Browse files Browse the repository at this point in the history
…rql.
  • Loading branch information
akodelia committed Jun 25, 2024
1 parent bc08053 commit f98df68
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
10 changes: 5 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions tests/test_filter_cls/test_apply_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,3 +689,25 @@ def test_distinct_on_field_field_in_ordering():
def test_distinct_on_field_field_not_in_ordering():
_, qs = BooksFilterClass(book_qs).apply_filters('ordering(int_choice_field)')
assert not qs.query.distinct


@pytest.mark.django_db
@pytest.mark.parametrize(
'query',
(
'(not(ilike(title,*ermat*)))',
'(not(ilike(title,*ermat*))&not(ilike(author__name,*Foo*)))',
'(and(not(ilike(title,*ermat*)),not(ilike(author__name,*Foo*))))',
),
)
def test_complex_nested_queries(query):
publisher = [Publisher.objects.create() for _ in range(2)]

author = Author.objects.create(name='Foo', publisher=publisher[0], is_male=False)
Book.objects.create(amazon_rating=4.0, author=author, title='Fermats last theorem')

other_author = Author.objects.create(name='Bar', publisher=publisher[0], is_male=False)
other_book = Book.objects.create(amazon_rating=4.5, author=other_author, title="Madame Bovary")
other_book2 = Book.objects.create(amazon_rating=4.5, author=other_author, title="Madame Bovary")

assert apply_filters(query) == [other_book, other_book2]

0 comments on commit f98df68

Please sign in to comment.