diff --git a/tests/analytics_rules_v1_test.py b/tests/analytics_rules_v1_test.py index d222d99..d1021d8 100644 --- a/tests/analytics_rules_v1_test.py +++ b/tests/analytics_rules_v1_test.py @@ -45,7 +45,7 @@ def test_get_missing_analytics_rule(fake_analytics_rules: AnalyticsRulesV1) -> N """Test that the AnalyticsRulesV1 object can get a missing analytics_rule.""" analytics_rule = fake_analytics_rules["company_analytics_rule"] - assert analytics_rule.rule_id == "company_analytics_rule" + assert analytics_rule.rule_name == "company_analytics_rule" assert_match_object(analytics_rule.api_call, fake_analytics_rules.api_call) assert_object_lists_match( analytics_rule.api_call.node_manager.nodes, diff --git a/tests/collection_test.py b/tests/collection_test.py index 7eb29fa..ddf4acb 100644 --- a/tests/collection_test.py +++ b/tests/collection_test.py @@ -52,7 +52,6 @@ def test_actual_retrieve( "infix": False, "stem": False, "stem_dictionary": "", - "truncate_len": 100, "store": True, }, { @@ -66,7 +65,6 @@ def test_actual_retrieve( "infix": False, "stem": False, "stem_dictionary": "", - "truncate_len": 100, "store": True, }, ], @@ -74,8 +72,6 @@ def test_actual_retrieve( "num_documents": 0, "symbols_to_index": [], "token_separators": [], - "synonym_sets": [], - "curation_sets": [], } response.pop("created_at") @@ -95,7 +91,7 @@ def test_actual_update( expected: CollectionSchema = { "fields": [ - {"name": "num_locations", "truncate_len": 100, "type": "int32"}, + {"name": "num_locations", "type": "int32"}, ], } diff --git a/tests/collections_test.py b/tests/collections_test.py index 788e3dc..bcee5ba 100644 --- a/tests/collections_test.py +++ b/tests/collections_test.py @@ -1,6 +1,5 @@ """Tests for the Collections class.""" - import sys from typesense.async_.api_call import AsyncApiCall @@ -113,7 +112,6 @@ def test_actual_create(actual_collections: Collections, delete_all: None) -> Non "infix": False, "stem": False, "stem_dictionary": "", - "truncate_len": 100, "store": True, }, { @@ -127,7 +125,6 @@ def test_actual_create(actual_collections: Collections, delete_all: None) -> Non "infix": False, "stem": False, "stem_dictionary": "", - "truncate_len": 100, "store": True, }, ], @@ -135,8 +132,6 @@ def test_actual_create(actual_collections: Collections, delete_all: None) -> Non "num_documents": 0, "symbols_to_index": [], "token_separators": [], - "synonym_sets": [], - "curation_sets": [], } response = actual_collections.create( @@ -185,7 +180,6 @@ def test_actual_retrieve( "infix": False, "stem": False, "stem_dictionary": "", - "truncate_len": 100, "store": True, }, { @@ -199,7 +193,6 @@ def test_actual_retrieve( "infix": False, "stem": False, "stem_dictionary": "", - "truncate_len": 100, "store": True, }, ], @@ -207,8 +200,6 @@ def test_actual_retrieve( "num_documents": 0, "symbols_to_index": [], "token_separators": [], - "synonym_sets": [], - "curation_sets": [], }, ] @@ -250,7 +241,6 @@ async def test_actual_create_async( "infix": False, "stem": False, "stem_dictionary": "", - "truncate_len": 100, "store": True, }, { @@ -264,7 +254,6 @@ async def test_actual_create_async( "infix": False, "stem": False, "stem_dictionary": "", - "truncate_len": 100, "store": True, }, ], @@ -272,8 +261,6 @@ async def test_actual_create_async( "num_documents": 0, "symbols_to_index": [], "token_separators": [], - "synonym_sets": [], - "curation_sets": [], } response = await actual_async_collections.create( @@ -322,7 +309,6 @@ async def test_actual_retrieve_async( "infix": False, "stem": False, "stem_dictionary": "", - "truncate_len": 100, "store": True, }, { @@ -336,7 +322,6 @@ async def test_actual_retrieve_async( "infix": False, "stem": False, "stem_dictionary": "", - "truncate_len": 100, "store": True, }, ], @@ -344,8 +329,6 @@ async def test_actual_retrieve_async( "num_documents": 0, "symbols_to_index": [], "token_separators": [], - "synonym_sets": [], - "curation_sets": [], }, ] diff --git a/tests/curation_set_test.py b/tests/curation_set_test.py index a75196a..95647d9 100644 --- a/tests/curation_set_test.py +++ b/tests/curation_set_test.py @@ -62,6 +62,8 @@ def test_actual_retrieve( "rule": { "match": "contains", "query": "shoe", + "stem": False, + "synonyms": False, }, "stop_processing": True, }, @@ -108,6 +110,8 @@ def test_actual_list_items( "rule": { "match": "contains", "query": "shoe", + "stem": False, + "synonyms": False, }, "stop_processing": True, }, @@ -140,6 +144,8 @@ def test_actual_get_item( "rule": { "match": "contains", "query": "shoe", + "stem": False, + "synonyms": False, }, "stop_processing": True, } @@ -218,6 +224,8 @@ async def test_actual_retrieve_async( "rule": { "match": "contains", "query": "shoe", + "stem": False, + "synonyms": False, }, "stop_processing": True, }, @@ -263,6 +271,8 @@ async def test_actual_list_items_async( "rule": { "match": "contains", "query": "shoe", + "stem": False, + "synonyms": False, }, "stop_processing": True, }, @@ -295,6 +305,8 @@ async def test_actual_get_item_async( "rule": { "match": "contains", "query": "shoe", + "stem": False, + "synonyms": False, }, "stop_processing": True, } diff --git a/tests/curation_sets_test.py b/tests/curation_sets_test.py index 0a06a05..e4a635a 100644 --- a/tests/curation_sets_test.py +++ b/tests/curation_sets_test.py @@ -87,6 +87,8 @@ def test_actual_upsert( "rule": { "match": "contains", "query": "shoe", + "stem": False, + "synonyms": False, }, "stop_processing": True, }, @@ -150,6 +152,8 @@ async def test_actual_upsert_async( "rule": { "match": "contains", "query": "shoe", + "stem": False, + "synonyms": False, }, "stop_processing": True, }, diff --git a/tests/metrics_test.py b/tests/metrics_test.py index 12fc300..6f2295d 100644 --- a/tests/metrics_test.py +++ b/tests/metrics_test.py @@ -42,18 +42,22 @@ def test_init_async(fake_async_api_call: AsyncApiCall) -> None: ) assert metrics.resource_path == "/metrics.json" # noqa: WPS437 +import platform + def test_actual_retrieve(actual_metrics: Metrics) -> None: """Test that the Metrics object can retrieve metrics on Typesense server and verify response structure.""" response = actual_metrics.retrieve() - assert "system_cpu_active_percentage" in response + if platform.system() == "Linux": + assert "system_cpu_active_percentage" in response + assert "system_network_received_bytes" in response + assert "system_network_sent_bytes" in response + assert "system_disk_total_bytes" in response assert "system_disk_used_bytes" in response assert "system_memory_total_bytes" in response assert "system_memory_used_bytes" in response - assert "system_network_received_bytes" in response - assert "system_network_sent_bytes" in response assert "typesense_memory_active_bytes" in response assert "typesense_memory_allocated_bytes" in response assert "typesense_memory_fragmentation_ratio" in response @@ -68,13 +72,15 @@ async def test_actual_retrieve_async(actual_async_metrics: AsyncMetrics) -> None """Test that the AsyncMetrics object can retrieve metrics on Typesense server and verify response structure.""" response = await actual_async_metrics.retrieve() - assert "system_cpu_active_percentage" in response + if platform.system() == "Linux": + assert "system_cpu_active_percentage" in response + assert "system_network_received_bytes" in response + assert "system_network_sent_bytes" in response + assert "system_disk_total_bytes" in response assert "system_disk_used_bytes" in response assert "system_memory_total_bytes" in response assert "system_memory_used_bytes" in response - assert "system_network_received_bytes" in response - assert "system_network_sent_bytes" in response assert "typesense_memory_active_bytes" in response assert "typesense_memory_allocated_bytes" in response assert "typesense_memory_fragmentation_ratio" in response diff --git a/tests/operations_test.py b/tests/operations_test.py index b48b946..71c134e 100644 --- a/tests/operations_test.py +++ b/tests/operations_test.py @@ -69,11 +69,11 @@ def test_cache_clear(actual_operations: Operations) -> None: assert response["success"] -def test_snapshot(actual_operations: Operations) -> None: +def test_snapshot(actual_operations: Operations, tmp_path) -> None: """Test that the Operations object can perform the snapshot operation.""" response = actual_operations.perform( "snapshot", - {"snapshot_path": "/tmp"}, # noqa: S108 + {"snapshot_path": str(tmp_path)}, # noqa: S108 ) assert response["success"] diff --git a/tests/override_test.py b/tests/override_test.py index 89526c7..47fc81b 100644 --- a/tests/override_test.py +++ b/tests/override_test.py @@ -47,7 +47,7 @@ def test_init(fake_api_call: ApiCall) -> None: fake_api_call.config.nearest_node, ) assert ( - override._endpoint_path() # noqa: WPS437 + override._endpoint_path # noqa: WPS437 == "/collections/companies/overrides/company_override" ) @@ -104,7 +104,7 @@ def test_init_async(fake_async_api_call: AsyncApiCall) -> None: fake_async_api_call.config.nearest_node, ) assert ( - override._endpoint_path() # noqa: WPS437 + override._endpoint_path # noqa: WPS437 == "/collections/companies/overrides/company_override" ) diff --git a/tests/overrides_test.py b/tests/overrides_test.py index a9376b5..de4de73 100644 --- a/tests/overrides_test.py +++ b/tests/overrides_test.py @@ -61,7 +61,7 @@ def test_get_missing_override(fake_overrides: Overrides) -> None: ) assert override.collection_name == "companies" assert ( - override._endpoint_path() # noqa: WPS437 + override._endpoint_path # noqa: WPS437 == "/collections/companies/overrides/company_override" ) @@ -186,7 +186,7 @@ def test_get_missing_override_async(fake_async_overrides) -> None: ) assert override.collection_name == "companies" assert ( - override._endpoint_path() # noqa: WPS437 + override._endpoint_path # noqa: WPS437 == "/collections/companies/overrides/company_override" ) diff --git a/tests/synonym_test.py b/tests/synonym_test.py index cfe6e51..d9affd9 100644 --- a/tests/synonym_test.py +++ b/tests/synonym_test.py @@ -45,7 +45,7 @@ def test_init(fake_api_call: ApiCall) -> None: fake_api_call.config.nearest_node, ) assert ( - synonym._endpoint_path() # noqa: WPS437 + synonym._endpoint_path # noqa: WPS437 == "/collections/companies/synonyms/company_synonym" ) @@ -99,7 +99,7 @@ def test_init_async(fake_async_api_call: AsyncApiCall) -> None: fake_async_api_call.config.nearest_node, ) assert ( - synonym._endpoint_path() # noqa: WPS437 + synonym._endpoint_path # noqa: WPS437 == "/collections/companies/synonyms/company_synonym" ) diff --git a/tests/synonyms_test.py b/tests/synonyms_test.py index 3402493..afe8638 100644 --- a/tests/synonyms_test.py +++ b/tests/synonyms_test.py @@ -62,7 +62,7 @@ def test_get_missing_synonym(fake_synonyms: Synonyms) -> None: ) assert synonym.collection_name == "companies" assert ( - synonym._endpoint_path() # noqa: WPS437 + synonym._endpoint_path # noqa: WPS437 == "/collections/companies/synonyms/company_synonym" ) @@ -174,7 +174,7 @@ def test_get_missing_synonym_async(fake_async_synonyms) -> None: ) assert synonym.collection_name == "companies" assert ( - synonym._endpoint_path() # noqa: WPS437 + synonym._endpoint_path # noqa: WPS437 == "/collections/companies/synonyms/company_synonym" )