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

Method test

tables/tests/test_array.py:2577–2593  ·  view source on GitHub ↗

Test correct broadcasting when the array atom is not scalar.

(self)

Source from the content-addressed store, hash-verified

2575class BroadcastTest(common.TempFileMixin, common.PyTablesTestCase):
2576
2577 def test(self):
2578 """Test correct broadcasting when the array atom is not scalar."""
2579
2580 array_shape = (2, 3)
2581 element_shape = (3,)
2582
2583 dtype = np.dtype((np.int64, element_shape))
2584 atom = tb.Atom.from_dtype(dtype)
2585 h5arr = self.h5file.create_array(
2586 self.h5file.root, "array", atom=atom, shape=array_shape
2587 )
2588
2589 size = np.prod(element_shape)
2590 nparr = np.arange(size).reshape(element_shape)
2591
2592 h5arr[0] = nparr
2593 self.assertTrue(np.all(h5arr[0] == nparr))
2594
2595
2596class TestCreateArrayArgs(common.TempFileMixin, common.PyTablesTestCase):

Callers

nothing calls this directly

Calls 3

dtypeMethod · 0.45
from_dtypeMethod · 0.45
create_arrayMethod · 0.45

Tested by

no test coverage detected