MCPcopy Index your code
hub / github.com/Project-MONAI/MONAI / test_numpy_values

Method test_numpy_values

tests/transforms/test_copy_itemsd.py:36–43  ·  view source on GitHub ↗
(self, keys, times, names)

Source from the content-addressed store, hash-verified

34class TestCopyItemsd(unittest.TestCase):
35 @parameterized.expand([TEST_CASE_1, TEST_CASE_2, TEST_CASE_3, TEST_CASE_4])
36 def test_numpy_values(self, keys, times, names):
37 input_data = {"img": np.array([[0, 1], [1, 2]]), "seg": np.array([[3, 4], [4, 5]])}
38 result = CopyItemsd(keys=keys, times=times, names=names)(input_data)
39 for name in ensure_tuple(names):
40 self.assertTrue(name in result)
41 result["img_1"] += 1
42 np.testing.assert_allclose(result["img_1"], np.array([[1, 2], [2, 3]]))
43 np.testing.assert_allclose(result["img"], np.array([[0, 1], [1, 2]]))
44
45 def test_default_names(self):
46 input_data = {"img": np.array([[0, 1], [1, 2]]), "seg": np.array([[3, 4], [4, 5]])}

Callers

nothing calls this directly

Calls 3

CopyItemsdClass · 0.90
ensure_tupleFunction · 0.90
arrayMethod · 0.80

Tested by

no test coverage detected