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

Method test_one_of

tests/integration/test_one_of.py:234–242  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

232 self.assertTupleEqual(result.shape, (1, 101, 102, 103))
233
234 def test_one_of(self):
235 p = OneOf((A(), B(), C()), (1, 2, 1))
236 counts = [0] * 3
237 for _i in range(10000):
238 out = p(1.0)
239 counts[int(out - 2)] += 1
240 self.assertAlmostEqual(counts[0] / 10000, 0.25, delta=1.0)
241 self.assertAlmostEqual(counts[1] / 10000, 0.50, delta=1.0)
242 self.assertAlmostEqual(counts[2] / 10000, 0.25, delta=1.0)
243
244
245TEST_ONEOF_EXTENDED_TEST_CASES = [

Callers

nothing calls this directly

Calls 4

OneOfClass · 0.90
AClass · 0.70
BClass · 0.70
CClass · 0.70

Tested by

no test coverage detected