Skip to content

Commit 0dacbbe

Browse files
committed
update multi_pass_reader unittest
1 parent b1cc28d commit 0dacbbe

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

python/paddle/fluid/tests/unittests/test_multi_pass_reader.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,12 @@ def test_main(self):
5757
exe.run(fluid.default_startup_program())
5858

5959
batch_count = 0
60-
while not data_file.eof():
61-
img_val, = exe.run(fetch_list=[img])
60+
while True:
61+
try:
62+
img_val, = exe.run(fetch_list=[img])
63+
except fluid.core.EnforceNotMet as ex:
64+
self.assertIn("There is no next data.", ex.message)
65+
break
6266
batch_count += 1
6367
self.assertLessEqual(img_val.shape[0], self.batch_size)
6468
data_file.reset()

0 commit comments

Comments
 (0)