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

Method test_optional_none

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

Source from the content-addressed store, hash-verified

619 "intent(hide) should have failed on undefined dimensions")
620
621 def test_optional_none(self):
622 shape = (2, )
623 a = self.array(shape, intent.optional, None)
624 assert a.arr.shape == shape
625 assert a.arr_equal(a.arr, np.zeros(shape, dtype=self.type.dtype))
626
627 shape = (2, 3)
628 a = self.array(shape, intent.optional, None)
629 assert a.arr.shape == shape
630 assert a.arr_equal(a.arr, np.zeros(shape, dtype=self.type.dtype))
631 assert a.arr.flags["FORTRAN"] and not a.arr.flags["CONTIGUOUS"]
632
633 shape = (2, 3)
634 a = self.array(shape, intent.c.optional, None)
635 assert a.arr.shape == shape
636 assert a.arr_equal(a.arr, np.zeros(shape, dtype=self.type.dtype))
637 assert not a.arr.flags["FORTRAN"] and a.arr.flags["CONTIGUOUS"]
638
639 def test_optional_from_2seq(self):
640 obj = self.num2seq

Callers

nothing calls this directly

Calls 1

arr_equalMethod · 0.80

Tested by

no test coverage detected