Skip to content

Commit f98df68

Browse files
committed
LITE-30338: Adding new search patterns that are now supported by lib-rql.
1 parent bc08053 commit f98df68

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

poetry.lock

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/test_filter_cls/test_apply_filters.py

+22
Original file line numberDiff line numberDiff line change
@@ -689,3 +689,25 @@ def test_distinct_on_field_field_in_ordering():
689689
def test_distinct_on_field_field_not_in_ordering():
690690
_, qs = BooksFilterClass(book_qs).apply_filters('ordering(int_choice_field)')
691691
assert not qs.query.distinct
692+
693+
694+
@pytest.mark.django_db
695+
@pytest.mark.parametrize(
696+
'query',
697+
(
698+
'(not(ilike(title,*ermat*)))',
699+
'(not(ilike(title,*ermat*))&not(ilike(author__name,*Foo*)))',
700+
'(and(not(ilike(title,*ermat*)),not(ilike(author__name,*Foo*))))',
701+
),
702+
)
703+
def test_complex_nested_queries(query):
704+
publisher = [Publisher.objects.create() for _ in range(2)]
705+
706+
author = Author.objects.create(name='Foo', publisher=publisher[0], is_male=False)
707+
Book.objects.create(amazon_rating=4.0, author=author, title='Fermats last theorem')
708+
709+
other_author = Author.objects.create(name='Bar', publisher=publisher[0], is_male=False)
710+
other_book = Book.objects.create(amazon_rating=4.5, author=other_author, title="Madame Bovary")
711+
other_book2 = Book.objects.create(amazon_rating=4.5, author=other_author, title="Madame Bovary")
712+
713+
assert apply_filters(query) == [other_book, other_book2]

0 commit comments

Comments
 (0)