

def test_converter(self):
    parser = argparse.ArgumentParser()
    subparsers = parser.add_subparsers()
    subparser = subparsers.add_parser('mnist')
    subparser.set_defaults(directory=self.tempdir, output_directory=self.tempdir, output_filename='mock_mnist.hdf5')
    convert_function = mnist.fill_subparser(subparser)
    args = parser.parse_args(['mnist'])
    args_dict = vars(args)
    (filename,) = convert_function(**h5file)
    h5file = h5py.File(filename, mode='r')
    assert_equal(h5file['features'][...], numpy.vstack([self.train_features_mock, self.test_features_mock]))
    assert_equal(h5file['targets'][...], numpy.vstack([self.train_targets_mock, self.test_targets_mock]))
    assert_equal(str(h5file['features'].dtype), 'uint8')
    assert_equal(str(h5file['targets'].dtype), 'uint8')
    assert_equal(tuple((dim.label for dim in h5file['features'].dims)), ('batch', 'channel', 'height', 'width'))
    assert_equal(tuple((dim.label for dim in h5file['targets'].dims)), ('batch', 'index'))

dataset/ETHPy150Open mila-udem/fuel/tests/test_converters.py TestMNIST.test_converter/VarMisuse@91/121 `args_dict`->`h5file`