1414 end = datetime (2005 , 1 , 10 ), freq = 'Min' )
1515
1616test_series = Series (np .random .rand (len (dti )), dti )
17- test_frame = DataFrame (
17+ _test_frame = DataFrame (
1818 {'A' : test_series , 'B' : test_series , 'C' : np .arange (len (dti ))})
1919
2020
21+ @pytest .fixture
22+ def test_frame ():
23+ return _test_frame .copy ()
24+
25+
2126def test_str ():
2227
2328 r = test_series .resample ('H' )
@@ -76,7 +81,7 @@ def test_groupby_resample_on_api():
7681 assert_frame_equal (result , expected )
7782
7883
79- def test_pipe ():
84+ def test_pipe (test_frame ):
8085 # GH17905
8186
8287 # series
@@ -92,7 +97,7 @@ def test_pipe():
9297 tm .assert_frame_equal (result , expected )
9398
9499
95- def test_getitem ():
100+ def test_getitem (test_frame ):
96101
97102 r = test_frame .resample ('H' )
98103 tm .assert_index_equal (r ._selected_obj .columns , test_frame .columns )
@@ -111,7 +116,7 @@ def test_getitem():
111116
112117
113118@pytest .mark .parametrize ('key' , [['D' ], ['A' , 'D' ]])
114- def test_select_bad_cols (key ):
119+ def test_select_bad_cols (key , test_frame ):
115120 g = test_frame .resample ('H' )
116121 # 'A' should not be referenced as a bad column...
117122 # will have to rethink regex if you change message!
@@ -120,7 +125,7 @@ def test_select_bad_cols(key):
120125 g [key ]
121126
122127
123- def test_attribute_access ():
128+ def test_attribute_access (test_frame ):
124129
125130 r = test_frame .resample ('H' )
126131 tm .assert_series_equal (r .A .sum (), r ['A' ].sum ())
@@ -143,7 +148,7 @@ def test_api_compat_before_use():
143148 getattr (rs , attr )
144149
145150
146- def tests_skip_nuisance ():
151+ def tests_skip_nuisance (test_frame ):
147152
148153 df = test_frame
149154 df ['D' ] = 'foo'
0 commit comments