Skip to content

Commit d8c85d7

Browse files
Remove TestData from frame-tests test_repr_info.py
1 parent a1f44d3 commit d8c85d7

File tree

2 files changed

+36
-20
lines changed

2 files changed

+36
-20
lines changed

pandas/tests/frame/conftest.py

+17
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,23 @@
55
import pandas.util.testing as tm
66

77

8+
@pytest.fixture
9+
def empty_frame():
10+
"""
11+
Fixture for DataFrame that is empty
12+
"""
13+
return DataFrame()
14+
15+
16+
@pytest.fixture
17+
def float_frame():
18+
"""
19+
Fixture for DataFrame of floats with index of unique strings
20+
"""
21+
df = DataFrame(tm.getSeriesData())
22+
return df
23+
24+
825
@pytest.fixture
926
def float_frame_with_na():
1027
"""

pandas/tests/frame/test_repr_info.py

+19-20
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
option_context,
1919
period_range,
2020
)
21-
from pandas.tests.frame.common import TestData
2221
import pandas.util.testing as tm
2322

2423
import pandas.io.formats.format as fmt
@@ -27,21 +26,21 @@
2726
# structure
2827

2928

30-
class TestDataFrameReprInfoEtc(TestData):
31-
def test_repr_empty(self):
29+
class TestDataFrameReprInfoEtc:
30+
def test_repr_empty(self, empty_frame):
3231
# empty
33-
foo = repr(self.empty) # noqa
32+
foo = repr(empty_frame) # noqa
3433

3534
# empty with index
3635
frame = DataFrame(index=np.arange(1000))
3736
foo = repr(frame) # noqa
3837

39-
def test_repr_mixed(self):
38+
def test_repr_mixed(self, float_string_frame):
4039
buf = StringIO()
4140

4241
# mixed
43-
foo = repr(self.mixed_frame) # noqa
44-
self.mixed_frame.info(verbose=False, buf=buf)
42+
foo = repr(float_string_frame) # noqa
43+
float_string_frame.info(verbose=False, buf=buf)
4544

4645
@pytest.mark.slow
4746
def test_repr_mixed_big(self):
@@ -54,16 +53,16 @@ def test_repr_mixed_big(self):
5453

5554
foo = repr(biggie) # noqa
5655

57-
def test_repr(self):
56+
def test_repr(self, float_frame, empty_frame):
5857
buf = StringIO()
5958

6059
# small one
61-
foo = repr(self.frame)
62-
self.frame.info(verbose=False, buf=buf)
60+
foo = repr(float_frame)
61+
float_frame.info(verbose=False, buf=buf)
6362

6463
# even smaller
65-
self.frame.reindex(columns=["A"]).info(verbose=False, buf=buf)
66-
self.frame.reindex(columns=["A", "B"]).info(verbose=False, buf=buf)
64+
float_frame.reindex(columns=["A"]).info(verbose=False, buf=buf)
65+
float_frame.reindex(columns=["A", "B"]).info(verbose=False, buf=buf)
6766

6867
# exhausting cases in DataFrame.info
6968

@@ -72,7 +71,7 @@ def test_repr(self):
7271
foo = repr(no_index) # noqa
7372

7473
# no columns or index
75-
self.empty.info(buf=buf)
74+
empty_frame.info(buf=buf)
7675

7776
df = DataFrame(["a\n\r\tb"], columns=["a\n\r\td"], index=["a\n\r\tf"])
7877
assert "\t" not in repr(df)
@@ -96,7 +95,7 @@ def test_repr_big(self):
9695
biggie = DataFrame(np.zeros((200, 4)), columns=range(4), index=range(200))
9796
repr(biggie)
9897

99-
def test_repr_unsortable(self):
98+
def test_repr_unsortable(self, float_frame):
10099
# columns are not sortable
101100
import warnings
102101

@@ -115,13 +114,13 @@ def test_repr_unsortable(self):
115114
repr(unsortable)
116115

117116
fmt.set_option("display.precision", 3, "display.column_space", 10)
118-
repr(self.frame)
117+
repr(float_frame)
119118

120119
fmt.set_option("display.max_rows", 10, "display.max_columns", 2)
121-
repr(self.frame)
120+
repr(float_frame)
122121

123122
fmt.set_option("display.max_rows", 1000, "display.max_columns", 1000)
124-
repr(self.frame)
123+
repr(float_frame)
125124

126125
tm.reset_display_options()
127126

@@ -196,10 +195,10 @@ def test_latex_repr(self):
196195
# GH 12182
197196
assert df._repr_latex_() is None
198197

199-
def test_info(self):
198+
def test_info(self, float_frame, datetime_frame):
200199
io = StringIO()
201-
self.frame.info(buf=io)
202-
self.tsframe.info(buf=io)
200+
float_frame.info(buf=io)
201+
datetime_frame.info(buf=io)
203202

204203
frame = DataFrame(np.random.randn(5, 3))
205204

0 commit comments

Comments
 (0)