@@ -815,6 +815,30 @@ def test_constructor_list_str_na(self, string_dtype):
815
815
expected = DataFrame ({"A" : ['1.0' , '2.0' , None ]}, dtype = object )
816
816
assert_frame_equal (result , expected )
817
817
818
+ @pytest .mark .parametrize ("data, expected" , [
819
+ # empty
820
+ (DataFrame (), True ),
821
+ # multi-same
822
+ (DataFrame ({"A" : [1 , 2 ], "B" : [1 , 2 ]}), True ),
823
+ # multi-object
824
+ (DataFrame ({"A" : np .array ([1 , 2 ], dtype = object ),
825
+ "B" : np .array (["a" , "b" ], dtype = object )}), True ),
826
+ # multi-extension
827
+ (DataFrame ({"A" : pd .Categorical (['a' , 'b' ]),
828
+ "B" : pd .Categorical (['a' , 'b' ])}), True ),
829
+ # differ types
830
+ (DataFrame ({"A" : [1 , 2 ], "B" : [1. , 2. ]}), False ),
831
+ # differ sizes
832
+ (DataFrame ({"A" : np .array ([1 , 2 ], dtype = np .int32 ),
833
+ "B" : np .array ([1 , 2 ], dtype = np .int64 )}), False ),
834
+ # multi-extension differ
835
+ (DataFrame ({"A" : pd .Categorical (['a' , 'b' ]),
836
+ "B" : pd .Categorical (['b' , 'c' ])}), False ),
837
+
838
+ ])
839
+ def test_is_homogeneous (self , data , expected ):
840
+ assert data ._is_homogeneous is expected
841
+
818
842
819
843
class TestDataFrameDatetimeWithTZ (TestData ):
820
844
0 commit comments