Skip to content

Commit 848f162

Browse files
committed
make test_iterator parse a smaller file
1 parent adf6849 commit 848f162

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

pandas/tests/io/test_stata.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,25 +1340,26 @@ def _convert_categorical(from_frame: DataFrame) -> DataFrame:
13401340
return from_frame
13411341

13421342
def test_iterator(self, datapath):
1343-
fname = datapath("io", "data", "stata", "stata3_117.dta")
1343+
fname = datapath("io", "data", "stata", "stata12_117.dta")
13441344

13451345
parsed = read_stata(fname)
1346+
expected = parsed.iloc[0:5, :]
13461347

13471348
with read_stata(fname, iterator=True) as itr:
13481349
chunk = itr.read(5)
1349-
tm.assert_frame_equal(parsed.iloc[0:5, :], chunk)
1350+
tm.assert_frame_equal(expected, chunk)
13501351

13511352
with read_stata(fname, chunksize=5) as itr:
1352-
chunk = list(itr)
1353-
tm.assert_frame_equal(parsed.iloc[0:5, :], chunk[0])
1353+
chunk = next(itr)
1354+
tm.assert_frame_equal(expected, chunk)
13541355

13551356
with read_stata(fname, iterator=True) as itr:
13561357
chunk = itr.get_chunk(5)
1357-
tm.assert_frame_equal(parsed.iloc[0:5, :], chunk)
1358+
tm.assert_frame_equal(expected, chunk)
13581359

13591360
with read_stata(fname, chunksize=5) as itr:
13601361
chunk = itr.get_chunk()
1361-
tm.assert_frame_equal(parsed.iloc[0:5, :], chunk)
1362+
tm.assert_frame_equal(expected, chunk)
13621363

13631364
# GH12153
13641365
with read_stata(fname, chunksize=4) as itr:

0 commit comments

Comments
 (0)