Checking creation of large number of leafs (1024) per group. Variable 'maxchilds' controls this check. PyTables support up to 4096 childs per group, but this would take too much memory (up to 64 MB) for testing purposes (may be we can add a test for big platforms). A
(self)
| 15 | """Checks for maximum number of childs for a Group.""" |
| 16 | |
| 17 | def test00_leafs(self): |
| 18 | """Checking creation of large number of leafs (1024) per group. |
| 19 | |
| 20 | Variable 'maxchilds' controls this check. PyTables support up to |
| 21 | 4096 childs per group, but this would take too much memory (up |
| 22 | to 64 MB) for testing purposes (may be we can add a test for big |
| 23 | platforms). A 1024 childs run takes up to 30 MB. A 512 childs |
| 24 | test takes around 25 MB. |
| 25 | |
| 26 | """ |
| 27 | |
| 28 | maxchilds = 1000 |
| 29 | if verbose: |
| 30 | print("\n", "-=" * 30) |
| 31 | print("Running %s.test00_wideTree..." % self.__class__.__name__) |
| 32 | print("Maximum number of childs tested :", maxchilds) |
| 33 | # Open a new empty HDF5 file |
| 34 | # file = tempfile.mktemp(".h5") |
| 35 | file = "test_widetree.h5" |
| 36 | |
| 37 | fileh = tb.open_file(file, mode="w") |
| 38 | if verbose: |
| 39 | print("Children writing progress: ", end=" ") |
| 40 | for child in range(maxchilds): |
| 41 | if verbose: |
| 42 | print("%3d," % (child), end=" ") |
| 43 | a = [1, 1] |
| 44 | fileh.create_group( |
| 45 | fileh.root, "group" + str(child), "child: %d" % child |
| 46 | ) |
| 47 | fileh.create_array( |
| 48 | "/group" + str(child), |
| 49 | "array" + str(child), |
| 50 | a, |
| 51 | "child: %d" % child, |
| 52 | ) |
| 53 | if verbose: |
| 54 | print() |
| 55 | # Close the file |
| 56 | fileh.close() |
| 57 | |
| 58 | t1 = clock() |
| 59 | # Open the previous HDF5 file in read-only mode |
| 60 | fileh = tb.open_file(file, mode="r") |
| 61 | print( |
| 62 | "\nTime spent opening a file with %d groups + %d arrays: " |
| 63 | "%s s" % (maxchilds, maxchilds, clock() - t1) |
| 64 | ) |
| 65 | if verbose: |
| 66 | print("\nChildren reading progress: ", end=" ") |
| 67 | # Close the file |
| 68 | fileh.close() |
| 69 | # Then, delete the file |
| 70 | # os.remove(file) |
| 71 | |
| 72 | def test01_wide_tree(self): |
| 73 | """Checking creation of large number of groups (1024) per group. |
nothing calls this directly
no test coverage detected