1919_tsd = tm .getTimeSeriesData ()
2020
2121_frame = DataFrame (_seriesd )
22- _frame2 = DataFrame (_seriesd , columns = ["D" , "C" , "B" , "A" ])
2322_intframe = DataFrame ({k : v .astype (np .int64 ) for k , v in _seriesd .items ()})
2423
2524_tsframe = DataFrame (_tsd )
@@ -44,20 +43,13 @@ def assert_json_roundtrip_equal(result, expected, orient):
4443class TestPandasContainer :
4544 @pytest .fixture (autouse = True )
4645 def setup (self ):
47- self .empty_frame = DataFrame ()
48- self .frame = _frame .copy ()
49- self .frame2 = _frame2 .copy ()
5046 self .intframe = _intframe .copy ()
5147 self .tsframe = _tsframe .copy ()
5248 self .mixed_frame = _mixed_frame .copy ()
5349 self .categorical = _cat_frame .copy ()
5450
5551 yield
5652
57- del self .empty_frame
58-
59- del self .frame
60- del self .frame2
6153 del self .intframe
6254 del self .tsframe
6355 del self .mixed_frame
@@ -126,19 +118,19 @@ def test_frame_non_unique_columns_raises(self, orient):
126118 with pytest .raises (ValueError , match = msg ):
127119 df .to_json (orient = orient )
128120
129- def test_frame_default_orient (self ):
130- assert self . frame . to_json () == self . frame .to_json (orient = "columns" )
121+ def test_frame_default_orient (self , float_frame ):
122+ assert float_frame . to_json () == float_frame .to_json (orient = "columns" )
131123
132124 @pytest .mark .parametrize ("dtype" , [False , float ])
133125 @pytest .mark .parametrize ("convert_axes" , [True , False ])
134126 @pytest .mark .parametrize ("numpy" , [True , False ])
135- def test_roundtrip_simple (self , orient , convert_axes , numpy , dtype ):
136- data = self . frame .to_json (orient = orient )
127+ def test_roundtrip_simple (self , orient , convert_axes , numpy , dtype , float_frame ):
128+ data = float_frame .to_json (orient = orient )
137129 result = pd .read_json (
138130 data , orient = orient , convert_axes = convert_axes , numpy = numpy , dtype = dtype
139131 )
140132
141- expected = self . frame . copy ()
133+ expected = float_frame
142134
143135 assert_json_roundtrip_equal (result , expected , orient )
144136
@@ -226,12 +218,12 @@ def test_roundtrip_categorical(self, orient, convert_axes, numpy):
226218
227219 @pytest .mark .parametrize ("convert_axes" , [True , False ])
228220 @pytest .mark .parametrize ("numpy" , [True , False ])
229- def test_roundtrip_empty (self , orient , convert_axes , numpy ):
230- data = self . empty_frame .to_json (orient = orient )
221+ def test_roundtrip_empty (self , orient , convert_axes , numpy , empty_frame ):
222+ data = empty_frame .to_json (orient = orient )
231223 result = pd .read_json (
232224 data , orient = orient , convert_axes = convert_axes , numpy = numpy
233225 )
234- expected = self . empty_frame .copy ()
226+ expected = empty_frame .copy ()
235227
236228 # TODO: both conditions below are probably bugs
237229 if convert_axes :
@@ -738,11 +730,10 @@ def test_reconstruction_index(self):
738730 result = read_json (df .to_json ())
739731 tm .assert_frame_equal (result , df )
740732
741- def test_path (self ):
733+ def test_path (self , float_frame ):
742734 with tm .ensure_clean ("test.json" ) as path :
743735 for df in [
744- self .frame ,
745- self .frame2 ,
736+ float_frame ,
746737 self .intframe ,
747738 self .tsframe ,
748739 self .mixed_frame ,
0 commit comments