MCPcopy Create free account
hub / github.com/numpy/numpy / test_hidden

Method test_hidden

numpy/f2py/tests/test_array_from_pyobj.py:592–619  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

590 "intent(cache) should have failed on undefined dimensions")
591
592 def test_hidden(self):
593 shape = (2, )
594 a = self.array(shape, intent.hide, None)
595 assert a.arr.shape == shape
596 assert a.arr_equal(a.arr, np.zeros(shape, dtype=self.type.dtype))
597
598 shape = (2, 3)
599 a = self.array(shape, intent.hide, None)
600 assert a.arr.shape == shape
601 assert a.arr_equal(a.arr, np.zeros(shape, dtype=self.type.dtype))
602 assert a.arr.flags["FORTRAN"] and not a.arr.flags["CONTIGUOUS"]
603
604 shape = (2, 3)
605 a = self.array(shape, intent.c.hide, None)
606 assert a.arr.shape == shape
607 assert a.arr_equal(a.arr, np.zeros(shape, dtype=self.type.dtype))
608 assert not a.arr.flags["FORTRAN"] and a.arr.flags["CONTIGUOUS"]
609
610 shape = (-1, 3)
611 try:
612 a = self.array(shape, intent.hide, None)
613 except ValueError as msg:
614 if not str(msg).startswith(
615 "failed to create intent(cache|hide)|optional array"):
616 raise
617 else:
618 raise SystemError(
619 "intent(hide) should have failed on undefined dimensions")
620
621 def test_optional_none(self):
622 shape = (2, )

Callers

nothing calls this directly

Calls 2

arr_equalMethod · 0.80
startswithMethod · 0.80

Tested by

no test coverage detected