Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Used pytest's warns function.
  • Loading branch information
gabrieldemarmiesse committed Dec 2, 2018
commit c8fd39c3cb28721d6a80ae30f6b0895fbc9d803e
10 changes: 3 additions & 7 deletions tests/keras/utils/data_utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,22 +418,18 @@ def __getitem__(self, item):
TimeOutSequence([3, 2, 2, 3])), use_multiprocessing=True)
enqueuer.start(3, 10)
gen_output = enqueuer.get()
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
with pytest.warns(UserWarning, match='An input could not be retrieved.'):
for _ in range(4 * missing_idx):
next(gen_output)
assert 'An input could not be retrieved.' in str(w[-1].message)

enqueuer = OrderedEnqueuer(TimeOutSequence([3, 2, 2, 3]),
use_multiprocessing=True)
enqueuer.start(3, 10)
gen_output = enqueuer.get()
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
warning_msg = "The input {} could not be retrieved.".format(missing_idx)
with pytest.warns(UserWarning, match=warning_msg):
for _ in range(11):
next(gen_output)
assert "The input {} could not be retrieved.".format(
missing_idx) in str(w[-1].message)


if __name__ == '__main__':
Expand Down