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

Method test_shape

tests/data/test_grid_dataset.py:95–108  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

93 assert_allclose(result_loc, coord, type_test=True, device_test=True)
94
95 def test_shape(self):
96 # test Iterable input data
97 test_dataset = iter(["vwxyz", "helloworld", "worldfoobar"])
98 result = GridPatchDataset(data=test_dataset, patch_iter=identity_generator, with_coordinates=False)
99 output = []
100 n_workers = 0 if sys.platform == "win32" else 2
101 for item in DataLoader(result, batch_size=3, num_workers=n_workers):
102 output.append("".join(item))
103 if sys.platform == "win32":
104 expected = ["ar", "ell", "ldf", "oob", "owo", "rld", "vwx", "wor", "yzh"]
105 else:
106 expected = ["d", "dfo", "hel", "low", "oba", "orl", "orl", "r", "vwx", "yzw"]
107 self.assertEqual(len("".join(expected)), len("".join(list(test_dataset))))
108 self.assertEqual(sorted(output), sorted(expected))
109
110 def test_loading_array(self):
111 # test sequence input data with images

Callers

nothing calls this directly

Calls 3

GridPatchDatasetClass · 0.90
DataLoaderClass · 0.90
appendMethod · 0.45

Tested by

no test coverage detected