@@ -90,12 +90,8 @@ def get_schema(enable_dynamic_field: bool = True) -> CollectionSchema:
9090 is_primary = True ,
9191 auto_id = True ,
9292 )
93- embeddings_field = FieldSchema (
94- name = "embeddings" , dtype = DataType .FLOAT_VECTOR , dim = 384
95- )
96- record_id_field = FieldSchema (
97- name = "record_id" , dtype = DataType .VARCHAR , max_length = 64
98- )
93+ embeddings_field = FieldSchema (name = "embeddings" , dtype = DataType .FLOAT_VECTOR , dim = 384 )
94+ record_id_field = FieldSchema (name = "record_id" , dtype = DataType .VARCHAR , max_length = 64 )
9995
10096 schema = CollectionSchema (
10197 enable_dynamic_field = enable_dynamic_field ,
@@ -111,9 +107,7 @@ def get_schema(enable_dynamic_field: bool = True) -> CollectionSchema:
111107
112108def get_index_params () -> IndexParams :
113109 index_params = IndexParams ()
114- index_params .add_index (
115- field_name = "embeddings" , index_type = "AUTOINDEX" , metric_type = "COSINE"
116- )
110+ index_params .add_index (field_name = "embeddings" , index_type = "AUTOINDEX" , metric_type = "COSINE" )
117111 index_params .add_index (field_name = "record_id" , index_type = "Trie" )
118112 return index_params
119113
@@ -253,9 +247,7 @@ async def test_milvus_destination(
253247 logger .debug ("\n --- Running test_milvus_destination ---" )
254248 upload_file_with_embeddings = add_fake_embeddings (upload_file , tmp_path )
255249 file_data = FileData (
256- source_identifiers = SourceIdentifiers (
257- fullpath = str (upload_file ), filename = upload_file .stem
258- ),
250+ source_identifiers = SourceIdentifiers (fullpath = str (upload_file ), filename = upload_file .stem ),
259251 connector_type = CONNECTOR_TYPE ,
260252 identifier = "mock file data" ,
261253 )
@@ -321,9 +313,7 @@ async def test_milvus_metadata_storage_with_dynamic_fields(
321313 logger .debug ("\n --- Running test_milvus_metadata_storage_with_dynamic_fields ---" )
322314 upload_file_with_embeddings = add_fake_embeddings (upload_file , tmp_path )
323315 file_data = FileData (
324- source_identifiers = SourceIdentifiers (
325- fullpath = str (upload_file ), filename = upload_file .stem
326- ),
316+ source_identifiers = SourceIdentifiers (fullpath = str (upload_file ), filename = upload_file .stem ),
327317 connector_type = CONNECTOR_TYPE ,
328318 identifier = "metadata_test_file" ,
329319 )
@@ -335,9 +325,7 @@ async def test_milvus_metadata_storage_with_dynamic_fields(
335325 )
336326
337327 # Verify dynamic fields are enabled
338- assert (
339- uploader .has_dynamic_fields_enabled ()
340- ), "Collection should have dynamic fields enabled"
328+ assert uploader .has_dynamic_fields_enabled (), "Collection should have dynamic fields enabled"
341329
342330 staged_filepath = stager .run (
343331 elements_filepath = upload_file_with_embeddings ,
@@ -406,9 +394,9 @@ async def test_milvus_metadata_storage_with_dynamic_fields(
406394
407395 # Verify filename is specifically stored if present
408396 if "filename" in stored_metadata :
409- assert (
410- sample_result [ "filename" ] == upload_file . name
411- ), "Filename should be correctly stored"
397+ assert sample_result [ "filename" ] == upload_file . name , (
398+ "Filename should be correctly stored"
399+ )
412400
413401
414402@pytest .mark .asyncio
@@ -422,9 +410,7 @@ async def test_milvus_metadata_filtering_without_dynamic_fields(
422410 logger .debug ("\n --- Running test_milvus_metadata_filtering_without_dynamic_fields ---" )
423411 upload_file_with_embeddings = add_fake_embeddings (upload_file , tmp_path )
424412 file_data = FileData (
425- source_identifiers = SourceIdentifiers (
426- fullpath = str (upload_file ), filename = upload_file .stem
427- ),
413+ source_identifiers = SourceIdentifiers (fullpath = str (upload_file ), filename = upload_file .stem ),
428414 connector_type = CONNECTOR_TYPE ,
429415 identifier = "no_dynamic_test_file" ,
430416 )
@@ -438,9 +424,9 @@ async def test_milvus_metadata_filtering_without_dynamic_fields(
438424 )
439425
440426 # Verify dynamic fields are NOT enabled
441- assert (
442- not uploader . has_dynamic_fields_enabled ()
443- ), "Collection should NOT have dynamic fields enabled"
427+ assert not uploader . has_dynamic_fields_enabled (), (
428+ "Collection should NOT have dynamic fields enabled"
429+ )
444430
445431 staged_filepath = stager .run (
446432 elements_filepath = upload_file_with_embeddings ,
@@ -487,8 +473,8 @@ async def test_milvus_metadata_filtering_without_dynamic_fields(
487473
488474 # Verify that only core fields are present (no metadata fields)
489475 sample_result = results [0 ]
490- core_fields = {'id' , ' record_id' , ' embeddings' }
491-
476+ core_fields = {"id" , " record_id" , " embeddings" }
477+
492478 # The result should only contain the fields defined in the schema
493479 assert set (sample_result .keys ()) == core_fields , (
494480 "Unexpected fields found in collection with dynamic fields disabled. "
@@ -504,9 +490,9 @@ def test_dynamic_fields_detection(collection: str):
504490 connection_config = MilvusConnectionConfig (uri = DB_URI ),
505491 upload_config = MilvusUploaderConfig (db_name = DB_NAME , collection_name = collection ),
506492 )
507- assert (
508- uploader_with_dynamic . has_dynamic_fields_enabled ()
509- ), "Should detect dynamic fields are enabled"
493+ assert uploader_with_dynamic . has_dynamic_fields_enabled (), (
494+ "Should detect dynamic fields are enabled"
495+ )
510496
511497 # Test with dynamic fields disabled
512498 uploader_without_dynamic = MilvusUploader (
@@ -515,9 +501,9 @@ def test_dynamic_fields_detection(collection: str):
515501 db_name = DB_NAME , collection_name = COLLECTION_WITHOUT_DYNAMIC_FIELDS
516502 ),
517503 )
518- assert (
519- not uploader_without_dynamic . has_dynamic_fields_enabled ()
520- ), "Should detect dynamic fields are disabled"
504+ assert not uploader_without_dynamic . has_dynamic_fields_enabled (), (
505+ "Should detect dynamic fields are disabled"
506+ )
521507
522508
523509@pytest .mark .tags (CONNECTOR_TYPE , DESTINATION_TAG , VECTOR_DB_TAG )
@@ -548,9 +534,7 @@ def test_precheck_fails_on_nonexistent_collection(collection: str):
548534def test_precheck_fails_on_nonexisting_db (collection : str ):
549535 uploader = MilvusUploader (
550536 connection_config = MilvusConnectionConfig (uri = DB_URI ),
551- upload_config = MilvusUploaderConfig (
552- db_name = "nonexisting_db" , collection_name = collection
553- ),
537+ upload_config = MilvusUploaderConfig (db_name = "nonexisting_db" , collection_name = collection ),
554538 )
555539 with pytest .raises (
556540 DestinationConnectionError ,
0 commit comments