17
17
from pandas.core.index import MultiIndex
18
18
import pandas.util.testing as tm
19
19
20
- from .common import TestData
21
20
22
-
23
- class TestSeriesRepr(TestData):
21
+ class TestSeriesRepr:
24
22
def test_multilevel_name_print(self):
25
23
index = MultiIndex(
26
24
levels=[["foo", "bar", "baz", "qux"], ["one", "two", "three"]],
@@ -67,24 +65,24 @@ def test_name_printing(self):
67
65
s = Series(index=date_range("20010101", "20020101"), name="test")
68
66
assert "Name: test" in repr(s)
69
67
70
- def test_repr(self):
71
- str(self.ts )
72
- str(self.series )
73
- str(self.series .astype(int))
74
- str(self.objSeries )
68
+ def test_repr(self, datetime_series, string_series, object_series ):
69
+ str(datetime_series )
70
+ str(string_series )
71
+ str(string_series .astype(int))
72
+ str(object_series )
75
73
76
74
str(Series(tm.randn(1000), index=np.arange(1000)))
77
75
str(Series(tm.randn(1000), index=np.arange(1000, 0, step=-1)))
78
76
79
77
# empty
80
- str(self.empty )
78
+ str(Series() )
81
79
82
80
# with NaNs
83
- self.series [5:7] = np.NaN
84
- str(self.series )
81
+ string_series [5:7] = np.NaN
82
+ str(string_series )
85
83
86
84
# with Nones
87
- ots = self.ts .astype("O")
85
+ ots = datetime_series .astype("O")
88
86
ots[::2] = None
89
87
repr(ots)
90
88
@@ -102,8 +100,8 @@ def test_repr(self):
102
100
("\u03B1", "\u03B2", "\u03B3"),
103
101
("\u03B1", "bar"),
104
102
]:
105
- self.series .name = name
106
- repr(self.series )
103
+ string_series .name = name
104
+ repr(string_series )
107
105
108
106
biggie = Series(
109
107
tm.randn(1000), index=np.arange(1000), name=("foo", "bar", "baz")
0 commit comments