Skip to content

Commit 0aabe16

Browse files
committed
adding Mixin tests + overriding and fixing to pass tests
1 parent b454c74 commit 0aabe16

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

integrations/valkey/src/haystack_integrations/document_stores/valkey/document_store.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1544,7 +1544,7 @@ def _validate_and_normalize_metadata_fields(metadata_fields: dict[str, type[str]
15441544
msg = "metadata_fields must be a dictionary"
15451545
raise ValueError(msg)
15461546

1547-
type_mapping = {str: "tag", int: "numeric"}
1547+
type_mapping = {str: "tag", int: "numeric", float: "numeric"}
15481548

15491549
normalized = {}
15501550
for field_name, field_type in metadata_fields.items():

integrations/valkey/tests/test_document_store.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@
1414
from haystack.dataclasses.byte_stream import ByteStream
1515
from haystack.document_stores.types import DuplicatePolicy
1616
from haystack.testing.document_store import (
17+
CountDocumentsByFilterTest,
1718
CountDocumentsTest,
19+
CountUniqueMetadataByFilterTest,
1820
DeleteAllTest,
1921
DeleteByFilterTest,
2022
DeleteDocumentsTest,
2123
FilterableDocsFixtureMixin,
24+
GetMetadataFieldMinMaxTest,
25+
GetMetadataFieldsInfoTest,
26+
GetMetadataFieldUniqueValuesTest,
2227
UpdateByFilterTest,
2328
WriteDocumentsTest,
2429
create_filterable_docs,
25-
CountDocumentsByFilterTest,
26-
CountUniqueMetadataByFilterTest,
27-
GetMetadataFieldsInfoTest,
28-
GetMetadataFieldMinMaxTest,
29-
GetMetadataFieldUniqueValuesTest,
3030
)
3131
from haystack.utils import Secret
3232

@@ -74,6 +74,8 @@ def document_store(self):
7474
"quality": str,
7575
"year": int,
7676
"featured": int, # for base-class test_update_by_filter_advanced_filters (meta.featured)
77+
"rating": float, # for GetMetadataFieldMinMaxTest (float field)
78+
"age": int, # for GetMetadataFieldMinMaxTest meta_prefix test
7779
# for base-class UpdateByFilterTest.filterable_docs and filter tests:
7880
"name": str,
7981
"page": str,
@@ -104,6 +106,10 @@ def test_write_documents(self, document_store):
104106
assert document_store.write_documents(docs) == 1
105107
assert document_store.count_documents() == 1
106108

109+
def test_get_metadata_fields_info_empty_collection(self, document_store):
110+
"""Valkey pre-configures metadata fields at init, so they're always present even when empty."""
111+
pytest.skip("Valkey metadata fields are pre-configured at init, not discovered from documents")
112+
107113
def test_write_documents_duplicate_fail(self, document_store):
108114
"""Valkey only supports OVERWRITE policy, skip FAIL test."""
109115
pytest.skip("Valkey only supports DuplicatePolicy.OVERWRITE")

0 commit comments

Comments
 (0)