MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / test_exception

Method test_exception

tests/handlers/test_handler_stats.py:189–201  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

187 self.assertGreater(content_count, 0)
188
189 def test_exception(self):
190 # set up engine
191 def _train_func(engine, batch):
192 raise RuntimeError("test exception.")
193
194 engine = Engine(_train_func)
195
196 # set up testing handler
197 stats_handler = StatsHandler()
198 stats_handler.attach(engine)
199
200 with self.assertRaises(RuntimeError):
201 engine.run(range(3), max_epochs=2)
202
203 def test_attributes_print(self):
204 log_stream = StringIO()

Callers

nothing calls this directly

Calls 3

attachMethod · 0.95
StatsHandlerClass · 0.90
runMethod · 0.45

Tested by

no test coverage detected