18
18
option_context ,
19
19
period_range ,
20
20
)
21
- from pandas .tests .frame .common import TestData
22
21
import pandas .util .testing as tm
23
22
24
23
import pandas .io .formats .format as fmt
27
26
# structure
28
27
29
28
30
- class TestDataFrameReprInfoEtc ( TestData ) :
31
- def test_repr_empty (self ):
29
+ class TestDataFrameReprInfoEtc :
30
+ def test_repr_empty (self , empty_frame ):
32
31
# empty
33
- foo = repr (self . empty ) # noqa
32
+ foo = repr (empty_frame ) # noqa
34
33
35
34
# empty with index
36
35
frame = DataFrame (index = np .arange (1000 ))
37
36
foo = repr (frame ) # noqa
38
37
39
- def test_repr_mixed (self ):
38
+ def test_repr_mixed (self , float_string_frame ):
40
39
buf = StringIO ()
41
40
42
41
# 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 )
45
44
46
45
@pytest .mark .slow
47
46
def test_repr_mixed_big (self ):
@@ -54,16 +53,16 @@ def test_repr_mixed_big(self):
54
53
55
54
foo = repr (biggie ) # noqa
56
55
57
- def test_repr (self ):
56
+ def test_repr (self , float_frame , empty_frame ):
58
57
buf = StringIO ()
59
58
60
59
# 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 )
63
62
64
63
# 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 )
67
66
68
67
# exhausting cases in DataFrame.info
69
68
@@ -72,7 +71,7 @@ def test_repr(self):
72
71
foo = repr (no_index ) # noqa
73
72
74
73
# no columns or index
75
- self . empty .info (buf = buf )
74
+ empty_frame .info (buf = buf )
76
75
77
76
df = DataFrame (["a\n \r \t b" ], columns = ["a\n \r \t d" ], index = ["a\n \r \t f" ])
78
77
assert "\t " not in repr (df )
@@ -96,7 +95,7 @@ def test_repr_big(self):
96
95
biggie = DataFrame (np .zeros ((200 , 4 )), columns = range (4 ), index = range (200 ))
97
96
repr (biggie )
98
97
99
- def test_repr_unsortable (self ):
98
+ def test_repr_unsortable (self , float_frame ):
100
99
# columns are not sortable
101
100
import warnings
102
101
@@ -115,13 +114,13 @@ def test_repr_unsortable(self):
115
114
repr (unsortable )
116
115
117
116
fmt .set_option ("display.precision" , 3 , "display.column_space" , 10 )
118
- repr (self . frame )
117
+ repr (float_frame )
119
118
120
119
fmt .set_option ("display.max_rows" , 10 , "display.max_columns" , 2 )
121
- repr (self . frame )
120
+ repr (float_frame )
122
121
123
122
fmt .set_option ("display.max_rows" , 1000 , "display.max_columns" , 1000 )
124
- repr (self . frame )
123
+ repr (float_frame )
125
124
126
125
tm .reset_display_options ()
127
126
@@ -196,10 +195,10 @@ def test_latex_repr(self):
196
195
# GH 12182
197
196
assert df ._repr_latex_ () is None
198
197
199
- def test_info (self ):
198
+ def test_info (self , float_frame , datetime_frame ):
200
199
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 )
203
202
204
203
frame = DataFrame (np .random .randn (5 , 3 ))
205
204
0 commit comments