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

Method test_single_value

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

Source from the content-addressed store, hash-verified

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)]:
78 result = ToNumpy(dtype=np.uint8)(test_data)
79 self.assertIsInstance(result, np.ndarray)
80 assert_allclose(result, np.asarray(test_data), type_test=False)
81 self.assertEqual(result.ndim, 0)
82
83
84if __name__ == "__main__":

Callers

nothing calls this directly

Calls 3

ToNumpyClass · 0.90
assert_allcloseFunction · 0.90
arrayMethod · 0.80

Tested by

no test coverage detected