| 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 | |
| 246 | class TestModuleDeclaration: |