diff --git a/README.rst b/README.rst index 75b679b0a68a934d136a3e1cc8a4b5ca8097eba2..5e88b91b7415bdd36038e3884f5b0537d5f61341 100644 --- a/README.rst +++ b/README.rst @@ -4,7 +4,7 @@ .. image:: http://img.shields.io/badge/docs-stable-yellow.png :target: http://pythonhosted.org/bob.io.base/index.html .. image:: http://img.shields.io/badge/docs-latest-orange.png - :target: https://www.idiap.ch/software/bob/docs/latest/bioidiap/bob.io.base/master/index.html + :target: https://www.idiap.ch/software/bob/docs/latest/bob/bob.io.base/master/index.html .. image:: https://gitlab.idiap.ch/bob/bob.io.base/badges/master/build.svg :target: https://gitlab.idiap.ch/bob/bob.io.base/commits/master .. image:: https://img.shields.io/badge/gitlab-project-0000c0.svg diff --git a/bob/io/base/test_hdf5.py b/bob/io/base/test_hdf5.py index 376e2659f2f2a0b5120a320b340f73cee1677b74..67515049b27ac965d3b56d84d7f81050e0022fae 100644 --- a/bob/io/base/test_hdf5.py +++ b/bob/io/base/test_hdf5.py @@ -60,6 +60,18 @@ def read_write_array_check(outfile, dtype): arrays.append(nparray) read_write_check(outfile, dtype.__name__ + '_array', arrays) +def read_write_subarray_check(outfile, dtype): + N = 10 + SHAPE = (2, 3, 4, 2) #48 elements in arrays + arrays = [] + for k in range(N): + data = [random.uniform(0,N) for z in range(numpy.product(SHAPE))] + nparray = numpy.array(data, dtype=dtype).reshape(SHAPE) + usearray = nparray[:,1,1:2,:] + assert not usearray.flags.contiguous + arrays.append(usearray) + read_write_check(outfile, dtype.__name__ + '_subarray', arrays) + def test_can_create(): # This test demonstrates how to create HDF5 files from scratch, @@ -190,6 +202,21 @@ def test_type_support(): read_write_array_check(outfile, numpy.complex128) #read_write_array_check(outfile, numpy.complex256) #no numpy conversion + read_write_subarray_check(outfile, numpy.int8) + read_write_subarray_check(outfile, numpy.int16) + read_write_subarray_check(outfile, numpy.int32) + read_write_subarray_check(outfile, numpy.int64) + read_write_subarray_check(outfile, numpy.uint8) + read_write_subarray_check(outfile, numpy.uint16) + read_write_subarray_check(outfile, numpy.uint32) + read_write_subarray_check(outfile, numpy.uint64) + read_write_subarray_check(outfile, numpy.float32) + read_write_subarray_check(outfile, numpy.float64) + #read_write_subarray_check(outfile, numpy.float128) #no numpy conversion + read_write_subarray_check(outfile, numpy.complex64) + read_write_subarray_check(outfile, numpy.complex128) + #read_write_subarray_check(outfile, numpy.complex256) #no numpy conversion + finally: os.unlink(tmpname)