@@ -2757,3 +2757,29 @@ def convert_rows_list_to_csv_str(rows_list: List[str]):
27572757 sep = os .linesep
27582758 expected = sep .join (rows_list ) + sep
27592759 return expected
2760+
2761+
2762+ def allow_na_ops (obj : Any ) -> bool :
2763+ """Whether to skip test cases including NaN"""
2764+ is_bool_index = isinstance (obj , Index ) and obj .is_boolean ()
2765+ return not is_bool_index and obj ._can_hold_na
2766+
2767+
2768+ def check_ops_properties_valid (obj : Any , op : str ) -> None :
2769+ """ Validates that certain properties are available """
2770+ if isinstance (obj , Series ):
2771+ expected = Series (getattr (obj .index , op ), index = obj .index , name = "a" )
2772+ else :
2773+ expected = getattr (obj , op )
2774+
2775+ result = getattr (obj , op )
2776+
2777+ # these could be series, arrays or scalars
2778+ if isinstance (result , Series ) and isinstance (expected , Series ):
2779+ assert_series_equal (result , expected )
2780+ elif isinstance (result , Index ) and isinstance (expected , Index ):
2781+ assert_index_equal (result , expected )
2782+ elif isinstance (result , np .ndarray ) and isinstance (expected , np .ndarray ):
2783+ assert_numpy_array_equal (result , expected )
2784+ else :
2785+ assert result == expected
0 commit comments