Skip to content

Commit 882c02f

Browse files
Remove TestData from series-tests test_repr.py
* Replaced TestData usage in pandas/tests/series/test_repr.py with fixtures
1 parent 9828d34 commit 882c02f

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

pandas/tests/series/test_repr.py

+12-14
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@
1717
from pandas.core.index import MultiIndex
1818
import pandas.util.testing as tm
1919

20-
from .common import TestData
2120

22-
23-
class TestSeriesRepr(TestData):
21+
class TestSeriesRepr:
2422
def test_multilevel_name_print(self):
2523
index = MultiIndex(
2624
levels=[["foo", "bar", "baz", "qux"], ["one", "two", "three"]],
@@ -67,24 +65,24 @@ def test_name_printing(self):
6765
s = Series(index=date_range("20010101", "20020101"), name="test")
6866
assert "Name: test" in repr(s)
6967

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, empty_series):
69+
str(datetime_series)
70+
str(string_series)
71+
str(string_series.astype(int))
72+
str(object_series)
7573

7674
str(Series(tm.randn(1000), index=np.arange(1000)))
7775
str(Series(tm.randn(1000), index=np.arange(1000, 0, step=-1)))
7876

7977
# empty
80-
str(self.empty)
78+
str(empty_series)
8179

8280
# with NaNs
83-
self.series[5:7] = np.NaN
84-
str(self.series)
81+
string_series[5:7] = np.NaN
82+
str(string_series)
8583

8684
# with Nones
87-
ots = self.ts.astype("O")
85+
ots = datetime_series.astype("O")
8886
ots[::2] = None
8987
repr(ots)
9088

@@ -102,8 +100,8 @@ def test_repr(self):
102100
("\u03B1", "\u03B2", "\u03B3"),
103101
("\u03B1", "bar"),
104102
]:
105-
self.series.name = name
106-
repr(self.series)
103+
string_series.name = name
104+
repr(string_series)
107105

108106
biggie = Series(
109107
tm.randn(1000), index=np.arange(1000), name=("foo", "bar", "baz")

0 commit comments

Comments
 (0)