Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

draft: Remove astra test overrides #1000

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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