@@ -786,8 +786,9 @@ def assert_column_equal(col: _PandasColumn, pdcol:pd.Series):
786
786
assert col .offset == 0
787
787
assert col .null_count == pdcol .isnull ().sum ()
788
788
assert col .num_chunks () == 1
789
- pytest .raises (RuntimeError , col .get_mask )
790
- assert_buffer_equal (col .get_data_buffer (), pdcol )
789
+ if col .dtype [0 ] != _DtypeKind .STRING :
790
+ pytest .raises (RuntimeError , col ._get_validity_buffer )
791
+ assert_buffer_equal (col ._get_data_buffer (), pdcol )
791
792
792
793
def assert_dataframe_equal (dfo : DataFrameObject , df :pd .DataFrame ):
793
794
assert dfo .num_columns () == len (df .columns )
@@ -817,6 +818,7 @@ def test_noncontiguous_columns():
817
818
df = pd .DataFrame (arr , columns = ['a' , 'b' , 'c' ])
818
819
assert df ['a' ].to_numpy ().strides == (24 ,)
819
820
df2 = from_dataframe (df ) # uses default of allow_copy=True
821
+ assert_dataframe_equal (df .__dataframe__ (), df )
820
822
tm .assert_frame_equal (df , df2 )
821
823
822
824
with pytest .raises (RuntimeError ):
@@ -853,6 +855,8 @@ def test_string_dtype():
853
855
assert col .describe_null == (4 , 0 )
854
856
assert col .num_chunks () == 1
855
857
858
+ assert_dataframe_equal (df .__dataframe__ (), df )
859
+
856
860
def test_metadata ():
857
861
df = pd .DataFrame ({'A' : [1 , 2 , 3 , 4 ],'B' : [1 , 2 , 3 , 4 ]})
858
862
@@ -869,6 +873,7 @@ def test_metadata():
869
873
assert col_metadata [key ] == expected [key ]
870
874
871
875
df2 = from_dataframe (df )
876
+ assert_dataframe_equal (df .__dataframe__ (), df )
872
877
tm .assert_frame_equal (df , df2 )
873
878
874
879
0 commit comments