14
14
end = datetime (2005 , 1 , 10 ), freq = 'Min' )
15
15
16
16
test_series = Series (np .random .rand (len (dti )), dti )
17
- test_frame = DataFrame (
17
+ _test_frame = DataFrame (
18
18
{'A' : test_series , 'B' : test_series , 'C' : np .arange (len (dti ))})
19
19
20
20
21
+ @pytest .fixture
22
+ def test_frame ():
23
+ return _test_frame .copy ()
24
+
25
+
21
26
def test_str ():
22
27
23
28
r = test_series .resample ('H' )
@@ -76,7 +81,7 @@ def test_groupby_resample_on_api():
76
81
assert_frame_equal (result , expected )
77
82
78
83
79
- def test_pipe ():
84
+ def test_pipe (test_frame ):
80
85
# GH17905
81
86
82
87
# series
@@ -92,7 +97,7 @@ def test_pipe():
92
97
tm .assert_frame_equal (result , expected )
93
98
94
99
95
- def test_getitem ():
100
+ def test_getitem (test_frame ):
96
101
97
102
r = test_frame .resample ('H' )
98
103
tm .assert_index_equal (r ._selected_obj .columns , test_frame .columns )
@@ -111,7 +116,7 @@ def test_getitem():
111
116
112
117
113
118
@pytest .mark .parametrize ('key' , [['D' ], ['A' , 'D' ]])
114
- def test_select_bad_cols (key ):
119
+ def test_select_bad_cols (key , test_frame ):
115
120
g = test_frame .resample ('H' )
116
121
# 'A' should not be referenced as a bad column...
117
122
# will have to rethink regex if you change message!
@@ -120,7 +125,7 @@ def test_select_bad_cols(key):
120
125
g [key ]
121
126
122
127
123
- def test_attribute_access ():
128
+ def test_attribute_access (test_frame ):
124
129
125
130
r = test_frame .resample ('H' )
126
131
tm .assert_series_equal (r .A .sum (), r ['A' ].sum ())
@@ -143,7 +148,7 @@ def test_api_compat_before_use():
143
148
getattr (rs , attr )
144
149
145
150
146
- def tests_skip_nuisance ():
151
+ def tests_skip_nuisance (test_frame ):
147
152
148
153
df = test_frame
149
154
df ['D' ] = 'foo'
0 commit comments