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

Method test_inv_array_size

numpy/f2py/tests/test_crackfortran.py:223–243  ·  view source on GitHub ↗
(self, dimspec)

Source from the content-addressed store, hash-verified

221
222 @pytest.mark.parametrize("dimspec", all_dimspecs)
223 def test_inv_array_size(self, dimspec):
224
225 count = self.all_dimspecs.index(dimspec)
226 get_arr_size = getattr(self.module, f"get_arr_size_{count}")
227 get_inv_arr_size = getattr(self.module, f"get_inv_arr_size_{count}")
228
229 for n in [1, 2, 3, 4, 5]:
230 sz, a = get_arr_size(n)
231 if dimspec in self.nonlinear_dimspecs:
232 # one must specify n as input, the call we'll ensure
233 # that a and n are compatible:
234 n1 = get_inv_arr_size(a, n)
235 else:
236 # in case of linear dependence, n can be determined
237 # from the shape of a:
238 n1 = get_inv_arr_size(a)
239 # n1 may be different from n (for instance, when `a` size
240 # is a function of some `n` fraction) but it must produce
241 # the same sized array
242 sz1, _ = get_arr_size(n1)
243 assert sz == sz1, (n, n1, sz, sz1)
244
245
246class TestModuleDeclaration:

Callers

nothing calls this directly

Calls 1

indexMethod · 0.45

Tested by

no test coverage detected