

def test_download_and_convert(self):
    tempdir = self.tempdir
    with remember_cwd():
        os.chdir(tempdir)
        assert_raises(IOError, iris.convert_iris, directory=tempdir, output_directory=tempdir)
        default_downloader(directory=tempdir, urls=['https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data'], filenames=['iris.data'])
        classes = {
            b'Iris-setosa': 0,
            b'Iris-versicolor': 1,
            b'Iris-virginica': 2,
        }
        data = numpy.loadtxt(os.path.join(tempdir, 'iris.data'), converters={
            4: (lambda x: classes[x]),
        }, delimiter=',')
        features = data[:, :(- 1)].astype('float32')
        targets = data[:, (- 1)].astype('uint8').reshape(((- 1), 1))
        iris.convert_iris(directory=tempdir, output_directory=tempdir)
    output_file = 'iris.hdf5'
    output_file = os.path.join(tempdir, output_file)
    with h5py.File(output_file, 'r') as h5:
        assert numpy.allclose(h5['features'], features)
        assert numpy.allclose(h5['targets'], targets)

dataset/ETHPy150Open mila-udem/fuel/tests/test_converters.py TestIris.test_download_and_convert/original