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