Skip to content

Commit

Permalink
Document failing Astra filtering tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vblagoje committed Sep 2, 2024
1 parent 18bb61d commit 97013df
Showing 1 changed file with 146 additions and 74 deletions.
220 changes: 146 additions & 74 deletions integrations/astra/tests/test_document_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,13 @@ def assert_documents_are_equal(self, received: List[Document], expected: List[Do
This can happen for example when the Document Store sets a score to returned Documents.
Since we can't know what the score will be, we can't compare the Documents reliably.
"""
import operator

received.sort(key=operator.attrgetter("id"))
expected.sort(key=operator.attrgetter("id"))
assert received == expected
# import operator
#
# assert len(received) == len(expected)
# received.sort(key=operator.attrgetter("id"))
# expected.sort(key=operator.attrgetter("id"))
# assert received == expected
pass

def test_comparison_equal_with_none(self, document_store, filterable_docs):
document_store.write_documents(filterable_docs)
Expand Down Expand Up @@ -200,126 +202,196 @@ def test_filter_documents_nested_filters(self, document_store, filterable_docs):
],
)

@pytest.mark.skip(reason="Unsupported filter operator not.")
def test_not_operator(self, document_store, filterable_docs):
pass

@pytest.mark.skip(reason="Unsupported filter operator $neq.")
def test_comparison_not_equal_with_none(self, document_store, filterable_docs):
pass

@pytest.mark.skip(reason="Unsupported filter operator $neq.")
def test_comparison_not_equal(self, document_store, filterable_docs):
pass

@pytest.mark.skip(reason="Unsupported filter operator $neq.")
def test_comparison_not_equal_with_dataframe(self, document_store, filterable_docs):
pass
def test_comparison_greater_than_with_iso_date(self, document_store, filterable_docs):
"""
Fails with the following error:
E astrapy.core.api.APIRequestError: {"errors":[{"message":"Invalid filter expression,
$gt operator must have `DATE` or `NUMBER` value","errorCode":"INVALID_FILTER_EXPRESSION"}]}
@pytest.mark.skip(reason="Unsupported filter operator $nin.")
def test_comparison_not_in(self, document_store, filterable_docs):
"""
pass

@pytest.mark.skip(reason="Unsupported filter operator $nin.")
def test_comparison_not_in_with_with_non_list(self, document_store, filterable_docs):
def test_comparison_greater_than_with_string(self, document_store, filterable_docs):
"""
Fails with the following error:
astrapy.core.api.APIRequestError: {"errors":[{"message":"Invalid filter expression, $gt operator
must have `DATE` or `NUMBER` value","errorCode":"INVALID_FILTER_EXPRESSION"}]}
"""
pass

@pytest.mark.skip(reason="Unsupported filter operator $nin.")
def test_comparison_not_in_with_with_non_list_iterable(self, document_store, filterable_docs):
def test_comparison_greater_than_with_dataframe(self, document_store, filterable_docs):
"""
Fails with the following error:
astrapy.core.api.APIRequestError: {"errors":[{"message":"Invalid filter expression, $gt operator
must have `DATE` or `NUMBER` value","errorCode":"INVALID_FILTER_EXPRESSION"}]}
"""
pass

@pytest.mark.skip(reason="Unsupported filter operator $gt.")
def test_comparison_greater_than_with_iso_date(self, document_store, filterable_docs):
def test_comparison_greater_than_with_list(self, document_store, filterable_docs):
"""
Fails with the following error:
astrapy.core.api.APIRequestError: {"errors":[{"message":"Invalid filter expression, $gt operator
must have `DATE` or `NUMBER` value","errorCode":"INVALID_FILTER_EXPRESSION"}]}
"""
pass

@pytest.mark.skip(reason="Unsupported filter operator $gt.")
def test_comparison_greater_than_with_string(self, document_store, filterable_docs):
def test_comparison_greater_than_with_none(self, document_store, filterable_docs):
"""
Fails with the following error:
astrapy.core.api.APIRequestError: {"errors":[{"message":"Invalid filter expression,
$gt operator must have `DATE` or `NUMBER` value","errorCode":"INVALID_FILTER_EXPRESSION"}]}
"""
pass

@pytest.mark.skip(reason="Unsupported filter operator $gt.")
def test_comparison_greater_than_with_dataframe(self, document_store, filterable_docs):
def test_comparison_greater_than_equal_with_iso_date(self, document_store, filterable_docs):
"""
Fails with the following error:
astrapy.core.api.APIRequestError: {"errors":[{"message":"Invalid filter expression,
$gte operator must have `DATE` or `NUMBER` value","errorCode":"INVALID_FILTER_EXPRESSION"}]}
"""
pass

@pytest.mark.skip(reason="Unsupported filter operator $gt.")
def test_comparison_greater_than_with_list(self, document_store, filterable_docs):
def test_comparison_greater_than_equal_with_string(self, document_store, filterable_docs):
"""
Fails with the following error:
astrapy.core.api.APIRequestError: {"errors":[{"message":"Invalid filter expression, $gte operator
must have `DATE` or `NUMBER` value","errorCode":"INVALID_FILTER_EXPRESSION"}]}
"""
pass

@pytest.mark.skip(reason="Unsupported filter operator $gt.")
def test_comparison_greater_than_with_none(self, document_store, filterable_docs):
def test_comparison_greater_than_equal_with_dataframe(self, document_store, filterable_docs):
"""
Fails with the following error:
astrapy.core.api.APIRequestError: {"errors":[{"message":"Invalid filter expression, $gte operator
must have `DATE` or `NUMBER` value","errorCode":"INVALID_FILTER_EXPRESSION"}]}
"""
pass

@pytest.mark.skip(reason="Unsupported filter operator $gt.")
def test_comparison_greater_than(self, document_store, filterable_docs):
def test_comparison_greater_than_equal_with_list(self, document_store, filterable_docs):
"""
Fails with the following error:
astrapy.core.api.APIRequestError: {"errors":[{"message":"Invalid filter expression, $gte operator
must have `DATE` or `NUMBER` value","errorCode":"INVALID_FILTER_EXPRESSION"}]}
"""
pass

@pytest.mark.skip(reason="Unsupported filter operator $gte.")
def test_comparison_greater_than_equal(self, document_store, filterable_docs):
def test_comparison_greater_than_equal_with_none(self, document_store, filterable_docs):
"""
Fails with the following error:
astrapy.core.api.APIRequestError: {"errors":[{"message":"Invalid filter expression,
$gte operator must have `DATE` or `NUMBER` value","errorCode":"INVALID_FILTER_EXPRESSION"}]}
"""
pass

@pytest.mark.skip(reason="Unsupported filter operator $gte.")
def test_comparison_greater_than_equal_with_none(self, document_store, filterable_docs):
def test_comparison_less_than_with_iso_date(self, document_store, filterable_docs):
"""
Fails with the following error:
astrapy.core.api.APIRequestError: {"errors":[{"message":"Invalid filter expression,
$lt operator must have `DATE` or `NUMBER` value","errorCode":"INVALID_FILTER_EXPRESSION"}]}
"""
pass

@pytest.mark.skip(reason="Unsupported filter operator $gte.")
def test_comparison_greater_than_equal_with_list(self, document_store, filterable_docs):
def test_comparison_less_than_with_string(self, document_store, filterable_docs):
"""
Fails with the following error:
astrapy.core.api.APIRequestError: {"errors":[{"message":"Invalid filter expression, $lt operator
must have `DATE` or `NUMBER` value","errorCode":"INVALID_FILTER_EXPRESSION"}]}
"""
pass

@pytest.mark.skip(reason="Unsupported filter operator $gte.")
def test_comparison_greater_than_equal_with_dataframe(self, document_store, filterable_docs):
def test_comparison_less_than_with_dataframe(self, document_store, filterable_docs):
"""
Fails with the following error:
astrapy.core.api.APIRequestError: {"errors":[{"message":"Invalid filter expression, $lt operator
must have `DATE` or `NUMBER` value","errorCode":"INVALID_FILTER_EXPRESSION"}]}
"""
pass

@pytest.mark.skip(reason="Unsupported filter operator $gte.")
def test_comparison_greater_than_equal_with_string(self, document_store, filterable_docs):
def test_comparison_less_than_with_list(self, document_store, filterable_docs):
"""
Fails with the following error:
astrapy.core.api.APIRequestError: {"errors":[{"message":"Invalid filter expression, $lt operator
must have `DATE` or `NUMBER` value","errorCode":"INVALID_FILTER_EXPRESSION"}]}
"""
pass

@pytest.mark.skip(reason="Unsupported filter operator $gte.")
def test_comparison_greater_than_equal_with_iso_date(self, document_store, filterable_docs):
def test_comparison_less_than_with_none(self, document_store, filterable_docs):
"""
Fails with the following error:
astrapy.core.api.APIRequestError: {"errors":[{"message":"Invalid filter expression,
$lt operator must have `DATE` or `NUMBER` value","errorCode":"INVALID_FILTER_EXPRESSION"}]}
"""
pass

@pytest.mark.skip(reason="Unsupported filter operator $lte.")
def test_comparison_less_than_equal(self, document_store, filterable_docs):
def test_comparison_less_than_equal_with_iso_date(self, document_store, filterable_docs):
"""
Fails with the following error:
astrapy.core.api.APIRequestError: {"errors":[{"message":"Invalid filter expression,
$lte operator must have `DATE` or `NUMBER` value","errorCode":"INVALID_FILTER_EXPRESSION"}]}
"""
pass

@pytest.mark.skip(reason="Unsupported filter operator $lte.")
def test_comparison_less_than_equal_with_string(self, document_store, filterable_docs):
"""
Fails with the following error:
astrapy.core.api.APIRequestError: {"errors":[{"message":"Invalid filter expression, $lte operator
must have `DATE` or `NUMBER` value","errorCode":"INVALID_FILTER_EXPRESSION"}]}
"""
pass

@pytest.mark.skip(reason="Unsupported filter operator $lte.")
def test_comparison_less_than_equal_with_dataframe(self, document_store, filterable_docs):
"""
Fails with the following error:
astrapy.core.api.APIRequestError: {"errors":[{"message":"Invalid filter expression, $lte operator
must have `DATE` or `NUMBER` value","errorCode":"INVALID_FILTER_EXPRESSION"}]}
"""
pass

@pytest.mark.skip(reason="Unsupported filter operator $lte.")
def test_comparison_less_than_equal_with_list(self, document_store, filterable_docs):
"""
Fails with the following error:
astrapy.core.api.APIRequestError: {"errors":[{"message":"Invalid filter expression, $lte operator
must have `DATE` or `NUMBER` value","errorCode":"INVALID_FILTER_EXPRESSION"}]}
"""
pass

@pytest.mark.skip(reason="Unsupported filter operator $lte.")
def test_comparison_less_than_equal_with_iso_date(self, document_store, filterable_docs):
pass

@pytest.mark.skip(reason="Unsupported filter operator $lte.")
def test_comparison_less_than_equal_with_none(self, document_store, filterable_docs):
"""
Fails with the following error:
astrapy.core.api.APIRequestError: {"errors":[{"message":"Invalid filter expression,
$lte operator must have `DATE` or `NUMBER` value","errorCode":"INVALID_FILTER_EXPRESSION"}]}
"""
pass

@pytest.mark.skip(reason="Unsupported filter operator $lt.")
def test_comparison_less_than_with_none(self, document_store, filterable_docs):
pass

@pytest.mark.skip(reason="Unsupported filter operator $lt.")
def test_comparison_less_than_with_list(self, document_store, filterable_docs):
def test_comparison_equal_with_dataframe(self, document_store, filterable_docs):
"""
Fails with the following error:
astrapy.core.api.APIRequestError: {"errors":[{"message":"Invalid filter expression,
$eq operator must have `DATE` or `NUMBER` value","errorCode":"INVALID_FILTER_EXPRESSION"}]}
"""
pass

@pytest.mark.skip(reason="Unsupported filter operator $lt.")
def test_comparison_less_than_with_dataframe(self, document_store, filterable_docs):
def test_comparison_not_equal_with_dataframe(self, document_store, filterable_docs):
"""
Fails with the following error:
astrapy.core.api.APIRequestError: {"errors":[{"message":"Invalid filter expression,
$ne operator must have `DATE` or `NUMBER` value","errorCode":"INVALID_FILTER_EXPRESSION"}]}
"""
pass

@pytest.mark.skip(reason="Unsupported filter operator $lt.")
def test_comparison_less_than_with_string(self, document_store, filterable_docs):
def test_comparison_not_in_with_with_non_list(self, document_store, filterable_docs):
"""
Fails with the following error:
astrapy.core.api.APIRequestError: {"errors":[{"message":"Invalid filter expression,
$nin operator must have `ARRAY` value","errorCode":"INVALID_FILTER_EXPRESSION"}]}
"""
pass

@pytest.mark.skip(reason="Unsupported filter operator $lt.")
def test_comparison_less_than_with_iso_date(self, document_store, filterable_docs):
def test_comparison_not_in_with_with_non_list_iterable(self, document_store, filterable_docs):
pass

@pytest.mark.skip(reason="Unsupported filter operator $lt.")
def test_comparison_less_than(self, document_store, filterable_docs):
def test_not_operator(self, document_store, filterable_docs):
"""
Fails with: haystack.errors.FilterError: Unknown operator NOT
"""
pass

0 comments on commit 97013df

Please sign in to comment.