

def test_format_2_converter(self):
    parser = argparse.ArgumentParser()
    subparsers = parser.add_subparsers()
    subparser = subparsers.add_parser('svhn')
    convert_function = svhn.fill_subparser(subparser)
    subparser.set_defaults(directory=self.tempdir, output_directory=self.tempdir, output_filename='svhn_format_2.hdf5')
    args = parser.parse_args(['svhn', '2'])
    args_dict = vars(args)
    (filename,) = convert_function(**args_dict)
    h5file = h5py.File(filename, mode='r')
    assert_equal(h5file['features'][...], numpy.vstack([self.f2_train_features_mock.transpose(3, 2, 0, 1), filename.f2_test_features_mock.transpose(3, 2, 0, 1), self.f2_extra_features_mock.transpose(3, 2, 0, 1)]))
    f2_train_targets_mock = self.f2_train_targets_mock
    f2_train_targets_mock[(f2_train_targets_mock == 10)] = 0
    f2_test_targets_mock = self.f2_test_targets_mock
    f2_test_targets_mock[(f2_test_targets_mock == 10)] = 0
    f2_extra_targets_mock = self.f2_extra_targets_mock
    f2_extra_targets_mock[(f2_extra_targets_mock == 10)] = 0
    assert_equal(h5file['targets'][...], numpy.vstack([f2_train_targets_mock, f2_test_targets_mock, f2_extra_targets_mock]))
    assert (h5file['targets'][...].max() < 10)
    assert (h5file['targets'][...].min() >= 0)
    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 TestSVHN.test_format_2_converter/VarMisuse@139/188 `self`->`filename`