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

Method test_str

tests/data/meta_tensor/test_meta_tensor.py:420–424  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

418 self.check(elem, im, ids=False)
419
420 def test_str(self):
421 t = MetaTensor([1.0], affine=torch.tensor(1), meta={"fname": "filename"})
422 self.assertEqual(str(t), "metatensor([1.])")
423 self.assertEqual(t.__repr__(), "metatensor([1.])")
424 self.assertEqual(f"{t[0]:.2f}", "1.00")
425
426 def test_shape(self):
427 s = MetaTensor([1])

Callers

nothing calls this directly

Calls 2

__repr__Method · 0.95
MetaTensorClass · 0.90

Tested by

no test coverage detected