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

Method test_list_tuple

tests/transforms/test_to_numpy.py:67–74  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

65 assert_allclose(result, test_data, type_test=False)
66
67 def test_list_tuple(self):
68 test_data = [[1, 2], [3, 4]]
69 result = ToNumpy()(test_data)
70 assert_allclose(result, np.asarray(test_data), type_test=False)
71 test_data = ((1, 2), (3, 4))
72 result = ToNumpy(wrap_sequence=False)(test_data)
73 self.assertIsInstance(result, tuple)
74 assert_allclose(result, ((np.asarray(1), np.asarray(2)), (np.asarray(3), np.asarray(4))))
75
76 def test_single_value(self):
77 for test_data in [5, np.array(5), torch.tensor(5)]:

Callers

nothing calls this directly

Calls 2

ToNumpyClass · 0.90
assert_allcloseFunction · 0.90

Tested by

no test coverage detected