MCPcopy Create free account
hub / github.com/PyTables/PyTables / test00_Leafs

Method test00_Leafs

tables/tests/test_tree.py:852–910  ·  view source on GitHub ↗

Checking creation of large number of leafs (1024) per group. Variable 'maxchildren' controls this check. PyTables support up to 4096 children per group, but this would take too much memory (up to 64 MB) for testing purposes (maybe we can add a test for big platforms)

(self)

Source from the content-addressed store, hash-verified

850 """Checks for maximum number of children for a Group."""
851
852 def test00_Leafs(self):
853 """Checking creation of large number of leafs (1024) per group.
854
855 Variable 'maxchildren' controls this check. PyTables support up
856 to 4096 children per group, but this would take too much memory
857 (up to 64 MB) for testing purposes (maybe we can add a test for
858 big platforms). A 1024 children run takes up to 30 MB. A 512
859 children test takes around 25 MB.
860
861 """
862
863 if common.heavy:
864 maxchildren = 4096
865 else:
866 maxchildren = 256
867
868 if common.verbose:
869 print("\n", "-=" * 30)
870 print("Running %s.test00_wideTree..." % self.__class__.__name__)
871 print("Maximum number of children tested :", maxchildren)
872
873 a = [1, 1]
874 if common.verbose:
875 print("Children writing progress: ", end=" ")
876 for child in range(maxchildren):
877 if common.verbose:
878 print("%3d," % (child), end=" ")
879 self.h5file.create_array(
880 self.h5file.root, "array" + str(child), a, "child: %d" % child
881 )
882 if common.verbose:
883 print()
884
885 t1 = clock()
886 a = [1, 1]
887
888 # Open the previous HDF5 file in read-only mode
889 self._reopen()
890 if common.verbose:
891 print(
892 "\nTime spent opening a file with %d arrays: %s s"
893 % (maxchildren, clock() - t1)
894 )
895 print("\nChildren reading progress: ", end=" ")
896
897 # Get the metadata on the previosly saved arrays
898 for child in range(maxchildren):
899 if common.verbose:
900 print("%3d," % (child), end=" ")
901
902 # Create an array for later comparison
903 # Get the actual array
904 array_ = getattr(self.h5file.root, "array" + str(child))
905 b = array_.read()
906
907 # Arrays a and b must be equal
908 self.assertEqual(a, b)
909 if common.verbose:

Callers

nothing calls this directly

Calls 3

create_arrayMethod · 0.45
_reopenMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected