Skip to content

Commit 7181828

Browse files
committed
parameterize objects
1 parent 4775cac commit 7181828

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

pandas/tests/test_common.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -226,20 +226,19 @@ def test_standardize_mapping():
226226
assert isinstance(com.standardize_mapping(dd), partial)
227227

228228

229+
@pytest.mark.parametrize('frame', [
230+
pd.concat(100 * [DataFrame([[0.123456, 0.234567, 0.567567],
231+
[12.32112, 123123.2, 321321.2]],
232+
columns=['X', 'Y', 'Z'])], ignore_index=True),
233+
pd.concat(100 * [Series([0.123456, 0.234567, 0.567567], name='X')],
234+
ignore_index=True)])
229235
@pytest.mark.parametrize('method', ['to_pickle', 'to_json', 'to_csv'])
230-
def test_compression_size(method, compression):
231-
232-
df = pd.concat(100 * [DataFrame([[0.123456, 0.234567, 0.567567],
233-
[12.32112, 123123.2, 321321.2]],
234-
columns=['X', 'Y', 'Z'])],
235-
ignore_index=True)
236-
s = df.iloc[:, 0]
236+
def test_compression_size(frame, method, compression):
237237

238238
with tm.ensure_clean() as filename:
239-
for obj in [df, s]:
240-
getattr(obj, method)(filename, compression=compression)
241-
file_size = os.path.getsize(filename)
242-
getattr(obj, method)(filename, compression=None)
243-
uncompressed_file_size = os.path.getsize(filename)
244-
if compression:
245-
assert uncompressed_file_size > file_size
239+
getattr(frame, method)(filename, compression=compression)
240+
file_size = os.path.getsize(filename)
241+
getattr(frame, method)(filename, compression=None)
242+
uncompressed_file_size = os.path.getsize(filename)
243+
if compression:
244+
assert uncompressed_file_size > file_size

0 commit comments

Comments
 (0)