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

Method test01_iter

tables/tests/test_expression.py:1626–1662  ·  view source on GitHub ↗

Checking very large inputs (__iter__ version)

(self)

Source from the content-addressed store, hash-verified

1624 )
1625
1626 def test01_iter(self):
1627 """Checking very large inputs (__iter__ version)"""
1628
1629 shape = self.shape
1630 if shape[0] >= 2**24:
1631 # The iterator is much slower, so don't run it for
1632 # extremely large arrays.
1633 if common.verbose:
1634 print("Skipping this *very* long test")
1635 return
1636 # Use filters so as to not use too much space
1637 if tb.which_lib_version("lzo") is not None:
1638 filters = tb.Filters(complevel=1, complib="lzo", shuffle=False)
1639 else:
1640 filters = tb.Filters(complevel=1, shuffle=False)
1641
1642 # Build input arrays
1643 root = self.h5file.root
1644 a = self.h5file.create_carray(
1645 root, "a", atom=tb.Int32Atom(dflt=1), shape=shape, filters=filters
1646 )
1647 self.assertIsNotNone(a)
1648 b = self.h5file.create_carray(
1649 root, "b", atom=tb.Int32Atom(dflt=2), shape=shape, filters=filters
1650 )
1651 self.assertIsNotNone(b)
1652 r1 = self.h5file.create_carray(
1653 root, "r1", atom=tb.Int32Atom(dflt=3), shape=shape, filters=filters
1654 )
1655 # The expression
1656 expr = tb.Expr("a-b + 1")
1657 r1 = sum(expr) # Should give 0
1658 if common.verbose:
1659 print("Tested shape:", shape)
1660 print("Cummulated sum:", r1)
1661 print("Should look like:", 0)
1662 self.assertEqual(r1, 0, "Evaluate is returning a wrong value.")
1663
1664
1665# The next can go on regular tests, as it should be light enough

Callers

nothing calls this directly

Calls 1

create_carrayMethod · 0.80

Tested by

no test coverage detected