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

Method test_unfixed

tests/transforms/compose/test_some_of.py:121–138  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

119 self.assertEqual(subset_size_counts[3], iterations)
120
121 def test_unfixed(self):
122 iterations = 10000
123 num_transforms = (0, 3)
124 transform_counts = 3 * [0]
125 subset_size_counts = 4 * [0]
126
127 s = SomeOf((A(), B(), C()), num_transforms=num_transforms)
128
129 for _ in range(iterations):
130 output = s(1)
131 subset_size = self.update_transform_count(transform_counts, output)
132 subset_size_counts[subset_size] += 1
133
134 for i in range(3):
135 self.assertAlmostEqual(transform_counts[i] / iterations, 0.5, delta=0.01)
136
137 for i in range(4):
138 self.assertAlmostEqual(subset_size_counts[i] / iterations, 0.25, delta=0.01)
139
140 def test_non_dict_metatensor(self):
141 data = MetaTensor(1)

Callers

nothing calls this directly

Calls 5

SomeOfClass · 0.90
AClass · 0.70
BClass · 0.70
CClass · 0.70

Tested by

no test coverage detected