@@ -612,6 +612,26 @@ def create_entity(entity_name: str, dimensions: int, distance_type: VectorDistan
612612 assert env .sync (model )
613613 CosineVectorEntity_iduid = CosineVectorEntity ._iduid
614614
615+ store = env .create_store ()
616+ cosine_box = store .box (CosineVectorEntity )
617+ cosine_box .put (CosineVectorEntity (name = "CosineObj1" , vector = [2 , 1 ]))
618+ cosine_box .put (CosineVectorEntity (name = "CosineObj2" , vector = [- 6 , 0 ]))
619+ euclidean_box = store .box (EuclideanVectorEntity )
620+ euclidean_box .put (EuclideanVectorEntity (name = "EuclideanObj1" , vector = [5 , 4 ]))
621+ euclidean_box .put (EuclideanVectorEntity (name = "EuclideanObj2" , vector = [2 , - 6 ]))
622+ dot_product_box = store .box (DotProductEntity )
623+ dot_product_box .put (DotProductEntity (name = "DotProductObj1" , vector = [10 , 0 ]))
624+ assert cosine_box .get (1 ).name == "CosineObj1"
625+ assert cosine_box .get (2 ).name == "CosineObj2"
626+ assert euclidean_box .get (1 ).name == "EuclideanObj1"
627+ assert euclidean_box .get (2 ).name == "EuclideanObj2"
628+ assert dot_product_box .get (1 ).name == "DotProductObj1"
629+
630+ del cosine_box
631+ del euclidean_box
632+ del dot_product_box
633+ del store
634+
615635 # Rename CosineVectorEntity to MyCosineVectorEntity
616636 MyCosineVectorEntity = create_entity ("MyCosineVectorEntity" ,
617637 dimensions = 2 ,
@@ -623,3 +643,9 @@ def create_entity(entity_name: str, dimensions: int, distance_type: VectorDistan
623643 model .entity (DotProductEntity )
624644 assert env .sync (model )
625645 assert CosineVectorEntity_iduid == MyCosineVectorEntity ._iduid
646+
647+ # Check MyCosineVectorEntity objects are preserved after renaming
648+ store = env .create_store ()
649+ cosine_box = store .box (MyCosineVectorEntity )
650+ assert cosine_box .get (1 ).name == "CosineObj1"
651+ assert cosine_box .get (2 ).name == "CosineObj2"
0 commit comments