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

Method test_sample_operations

tests/apps/test_auto3dseg.py:252–265  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

250 assert test_ret_2["max"].ndim == 1
251
252 def test_sample_operations(self):
253 op = SampleOperations()
254 test_data_np = np.random.rand(10, 10).astype(np.float64)
255 test_data_mt = MetaTensor(test_data_np, device=device)
256 test_ret_np = op.evaluate(test_data_np)
257 test_ret_mt = op.evaluate(test_data_mt)
258 assert isinstance(test_ret_np["max"], Number)
259 assert isinstance(test_ret_np["percentile"], list)
260 assert isinstance(test_ret_mt["max"], Number)
261 assert isinstance(test_ret_mt["percentile"], list)
262
263 op.update({"sum": np.sum})
264 test_ret_np = op.evaluate(test_data_np)
265 assert "sum" in test_ret_np
266
267 def test_summary_operations(self):
268 op = SummaryOperations()

Callers

nothing calls this directly

Calls 5

evaluateMethod · 0.95
SampleOperationsClass · 0.90
MetaTensorClass · 0.90
astypeMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected