# -*- coding: utf-8 -*- ######################################################################## # # License: BSD # Created: 2005-09-29 # Author: Ivan Vilata i Balaguer - ivan@selidor.net # # $Id$ # ######################################################################## """Test module for compatibility with plain HDF files.""" import os import shutil import tempfile import numpy import tables from tables.tests import common from tables.tests.common import allequal from tables.tests.common import unittest, test_filename from tables.tests.common import PyTablesTestCase as TestCase class PaddedArrayTestCase(common.TestFileMixin, TestCase): """Test for H5T_COMPOUND (Table) datatype with padding. Regression test for issue gh-734 itemsize.h5 was created with h5py with the array `expectedData` (see below) in the table `/Test`: 'A' and 'B' are 4 + 4 bytes, with 8 bytes padding. $ h5ls -v itemsize.h5 Test Dataset {3/3} Location: 1:800 Links: 1 Storage: 48 logical bytes, 48 allocated bytes, 100.00% utilization Type: struct { "A" +0 native unsigned int "B" +4 native unsigned int } 16 bytes """ h5fname = test_filename('itemsize.h5') def test(self): arr = self.h5file.get_node('/Test') data = arr.read() expectedData = numpy.array( [(1, 11), (2, 12), (3, 13)], dtype={'names': ['A', 'B'], 'formats': ['