def test_values(self):
    datalist = [{'image': 'spleen_19.nii.gz', 'label': 'spleen_label_19.nii.gz'}, {'image': 'spleen_31.nii.gz', 'label': 'spleen_label_31.nii.gz'}]
    transform = Compose([DataStatsd(keys=['image', 'label'], data_shape=False, value_range=False, data_value=True), SimulateDelayd(keys=['image', 'label'], delay_time=0.1)])
    dataset = CacheDataset(data=datalist, transform=transform, cache_rate=0.5, cache_num=1)
    n_workers = (0 if (sys.platform == 'win32') else 2)
    dataloader = DataLoader(dataset=dataset, batch_size=2, num_workers=n_workers)
    for d in dataloader:
        self.assertEqual(d['image'][0], 'spleen_19.nii.gz')
        self.assertEqual(d['image'][1], 'spleen_31.nii.gz')
        self.assertEqual(d['label'][0], 'spleen_label_19.nii.gz')
        self.assertEqual(d['label'][1], 'spleen_label_31.nii.gz')
def test_values(self):
    datalist = [{'image': 'spleen_19.nii.gz', 'label': 'spleen_label_19.nii.gz'}, {'image': 'spleen_31.nii.gz', 'label': 'spleen_label_31.nii.gz'}]
    transform = Compose([DataStatsd(keys=['image', 'label'], data_shape=False, value_range=False, data_value=True), SimulateDelayd(keys=['image', 'label'], delay_time=0.1)])
    dataset = CacheDataset(data=datalist, transform=transform, cache_rate=0.5, cache_num=1)
    n_workers = (0 if (sys.platform == 'win32') else 2)
    dataloader = DataLoader(dataset=dataset, batch_size=2, num_workers=n_workers)
    for d in dataloader:
        self.assertEqual(d['image'][0], 'spleen_19.nii.gz')
        self.assertEqual(d['image'][1], 'spleen_31.nii.gz')
        self.assertEqual(d['label'][0], 'spleen_label_19.nii.gz')
        self.assertEqual(d['label'][1], 'spleen_label_31.nii.gz')