@@ -1876,9 +1876,7 @@ def test_error_handling_invalid_operations(self) -> None:
18761876 schema .create_index (config = fts_config , key = "#document" )
18771877
18781878 # Test 3: Cannot disable all indexes globally (no config, no key)
1879- with pytest .raises (
1880- ValueError , match = "Cannot disable all indexes"
1881- ):
1879+ with pytest .raises (ValueError , match = "Cannot disable all indexes" ):
18821880 schema .delete_index ()
18831881
18841882 # Test 4: Cannot enable all indexes globally
@@ -2790,12 +2788,14 @@ def test_cmek_schema_without_cmek_serialization(self) -> None:
27902788
27912789 def test_cmek_invalid_deserialization (self ) -> None :
27922790 """Test that invalid CMEK data raises a warning and sets cmek to None."""
2793- with pytest .raises (ValueError , match = "Unsupported or missing CMEK provider in data" ):
2794- Schema . deserialize_from_json (
2795- { "defaults" : {}, "keys" : {}, "cmek" : {}}
2796- )
2791+ with pytest .raises (
2792+ ValueError , match = "Unsupported or missing CMEK provider in data"
2793+ ):
2794+ Schema . deserialize_from_json ({ "defaults" : {}, "keys" : {}, "cmek" : {}} )
27972795
2798- with pytest .raises (ValueError , match = "Unsupported or missing CMEK provider in data" ):
2796+ with pytest .raises (
2797+ ValueError , match = "Unsupported or missing CMEK provider in data"
2798+ ):
27992799 Schema .deserialize_from_json (
28002800 {
28012801 "defaults" : {},
@@ -2804,6 +2804,7 @@ def test_cmek_invalid_deserialization(self) -> None:
28042804 }
28052805 )
28062806
2807+
28072808def test_sparse_vector_cannot_be_created_globally () -> None :
28082809 """Test that sparse vector index cannot be created globally (without a key)."""
28092810 schema = Schema ()
@@ -2964,15 +2965,11 @@ def test_delete_index_rejects_special_keys() -> None:
29642965 schema .delete_index (config = string_config , key = Key .DOCUMENT )
29652966
29662967 # Test that Key.EMBEDDING is rejected
2967- with pytest .raises (
2968- ValueError , match = "Cannot modify #embedding"
2969- ):
2968+ with pytest .raises (ValueError , match = "Cannot modify #embedding" ):
29702969 schema .delete_index (config = string_config , key = Key .EMBEDDING )
29712970
29722971 # Test that string "#embedding" is also rejected (for consistency)
2973- with pytest .raises (
2974- ValueError , match = "Cannot modify #embedding"
2975- ):
2972+ with pytest .raises (ValueError , match = "Cannot modify #embedding" ):
29762973 schema .delete_index (config = string_config , key = "#embedding" )
29772974
29782975 # Test that any other key starting with # is rejected (second check)
@@ -3156,7 +3153,11 @@ def test_config_classes_reject_invalid_fields() -> None:
31563153
31573154 error_msg = str (exc_info .value )
31583155 assert "key" in error_msg .lower ()
3159- assert "extra" in error_msg .lower () or "permitted" in error_msg .lower ()
3156+ assert (
3157+ "extra" in error_msg .lower ()
3158+ or "permitted" in error_msg .lower ()
3159+ or "not a valid field" in error_msg .lower ()
3160+ )
31603161
31613162 # Test VectorIndexConfig rejects invalid fields
31623163 with pytest .raises ((ValueError , ValidationError )) as exc_info :
0 commit comments