File tree 1 file changed +38
-0
lines changed
1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ import pytest
2
+
3
+ from pandas .core .base import PandasObject
4
+
5
+ pandas_object = PandasObject ()
6
+
7
+
8
+ class SubclassPandasObject (PandasObject ):
9
+ pass
10
+
11
+
12
+ subclass_pandas_object = SubclassPandasObject ()
13
+
14
+
15
+ @pytest .mark .parametrize ("other_object" , [pandas_object , subclass_pandas_object ])
16
+ def test_pandas_object_ensure_type (other_object ):
17
+ pandas_object = PandasObject ()
18
+ assert pandas_object ._ensure_type (other_object )
19
+
20
+
21
+ def test_pandas_object_ensure_type_for_same_object ():
22
+ pandas_object_a = PandasObject ()
23
+ pandas_object_b = pandas_object_a
24
+ assert pandas_object_a ._ensure_type (pandas_object_b )
25
+
26
+
27
+ class OtherClass :
28
+ pass
29
+
30
+
31
+ other_class = OtherClass ()
32
+
33
+
34
+ @pytest .mark .parametrize ("other_object" , [other_class ])
35
+ def test_pandas_object_ensure_type_for_false (other_object ):
36
+ pandas_object = PandasObject ()
37
+ with pytest .raises (AssertionError ):
38
+ assert pandas_object ._ensure_type (other_object )
You can’t perform that action at this time.
0 commit comments