File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -173,6 +173,10 @@ def __str__(self) -> str:
173173 """Return the string representation of the PrimitiveType class."""
174174 return self .root
175175
176+ def __deepcopy__ (self , memo : Dict [int , Any ]) -> PrimitiveType :
177+ """Deep copy the PrimitiveType class."""
178+ return self
179+
176180
177181class FixedType (PrimitiveType ):
178182 """A fixed data type in Iceberg.
Original file line number Diff line number Diff line change @@ -619,3 +619,14 @@ def test_types_singleton() -> None:
619619 assert id (BooleanType ()) == id (BooleanType ())
620620 assert id (FixedType (22 )) == id (FixedType (22 ))
621621 assert id (FixedType (19 )) != id (FixedType (25 ))
622+
623+
624+ def test_deepcopy_of_singleton_fixed_type () -> None :
625+ """FixedType is a singleton, so deepcopy should return the same instance"""
626+ from copy import deepcopy
627+
628+ list_of_fixed_types = [FixedType (22 ), FixedType (19 )]
629+ copied_list = deepcopy (list_of_fixed_types )
630+
631+ for lhs , rhs in zip (list_of_fixed_types , copied_list ):
632+ assert id (lhs ) == id (rhs )
You can’t perform that action at this time.
0 commit comments