Skip to content

Commit f20c051

Browse files
author
y-p
committed
TST: speed up long test (csv_moar)
1 parent 7cc19c0 commit f20c051

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

pandas/tests/test_frame.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4626,7 +4626,6 @@ def test_to_csv_from_csv(self):
46264626
def test_to_csv_moar(self):
46274627
from pandas.util.testing import makeCustomDataframe as mkdf
46284628
path = '__tmp_to_csv_moar__'
4629-
chunksize=1000
46304629

46314630
def _do_test(df,path,r_dtype=None,c_dtype=None,rnlvl=None,cnlvl=None,
46324631
dupe_col=False):
@@ -4705,33 +4704,33 @@ def stuple_to_tuple(x):
47054704

47064705

47074706
N = 100
4707+
chunksize=1000
47084708

4709-
for ncols in [128]:
4709+
for ncols in [4]:
47104710
base = int((chunksize// ncols or 1) or 1)
47114711
for nrows in [2,10,N-1,N,N+1,N+2,2*N-2,2*N-1,2*N,2*N+1,2*N+2,
47124712
base-1,base,base+1]:
47134713
_do_test(mkdf(nrows, ncols,r_idx_type='dt',
47144714
c_idx_type='s'),path, 'dt','s')
4715+
pass
47154716

4716-
for r_idx_type in ['i','s','u','p']:
4717-
for c_idx_type in ['i', 's','u','dt','p']:
4718-
for ncols in [1,2,128]:
4719-
base = int((chunksize// ncols or 1) or 1)
4720-
for nrows in [2,10,N-1,N,N+1,N+2,2*N-2,2*N-1,2*N,2*N+1,2*N+2,
4721-
base-1,base,base+1]:
4722-
_do_test(mkdf(nrows, ncols,r_idx_type=r_idx_type,
4723-
c_idx_type=c_idx_type),path,r_idx_type,c_idx_type)
4724-
4717+
for r_idx_type,c_idx_type in [('i','i'),('s','s'),('u','dt'),('p','p')]:
4718+
for ncols in [1,2,3,4]:
4719+
base = int((chunksize// ncols or 1) or 1)
4720+
for nrows in [2,10,N-1,N,N+1,N+2,2*N-2,2*N-1,2*N,2*N+1,2*N+2,
4721+
base-1,base,base+1]:
4722+
_do_test(mkdf(nrows, ncols,r_idx_type=r_idx_type,
4723+
c_idx_type=c_idx_type),path,r_idx_type,c_idx_type)
47254724

4726-
for ncols in [1,10,30]:
4725+
for ncols in [1,2,3,4]:
47274726
base = int((chunksize// ncols or 1) or 1)
47284727
for nrows in [10,N-2,N-1,N,N+1,N+2,2*N-2,2*N-1,2*N,2*N+1,2*N+2,
47294728
base-1,base,base+1]:
47304729
print( nrows,ncols)
47314730
_do_test(mkdf(nrows, ncols),path)
47324731

47334732
for nrows in [10,N-2,N-1,N,N+1,N+2]:
4734-
df = mkdf(nrows, 10)
4733+
df = mkdf(nrows, 3)
47354734
cols = list(df.columns)
47364735
cols[:2] = ["dupe","dupe"]
47374736
cols[-2:] = ["dupe","dupe"]
@@ -4745,7 +4744,7 @@ def stuple_to_tuple(x):
47454744

47464745
_do_test(DataFrame(index=range(10)),path)
47474746
_do_test(mkdf(chunksize//2+1, 2,r_idx_nlevels=2),path,rnlvl=2)
4748-
for ncols in [2,10,30]:
4747+
for ncols in [2,3,4]:
47494748
base = int(chunksize//ncols)
47504749
for nrows in [10,N-2,N-1,N,N+1,N+2,2*N-2,2*N-1,2*N,2*N+1,2*N+2,
47514750
base-1,base,base+1]:
@@ -6833,7 +6832,7 @@ def test_where_bug(self):
68336832
def test_where_datetime(self):
68346833

68356834
# GH 3311
6836-
df = DataFrame(dict(A = date_range('20130102',periods=5),
6835+
df = DataFrame(dict(A = date_range('20130102',periods=5),
68376836
B = date_range('20130104',periods=5),
68386837
C = np.random.randn(5)))
68396838

pandas/util/testing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def assert_frame_equal(left, right, check_dtype=True,
250250
assert(left.columns.names == right.columns.names)
251251

252252

253-
def assert_panel_equal(left, right,
253+
def assert_panel_equal(left, right,
254254
check_panel_type=False,
255255
check_less_precise=False):
256256
if check_panel_type:

0 commit comments

Comments
 (0)