class_docstr: This test suite tests various expressions that are used as dimension
  specifications.
  
  There exists two usage cases where analyzing dimensions
  specifications are important.
  
  In the first case, the size of output arrays must be defined based
  on the inputs to a Fortran function. Because Fortran supports
  arbitrary bases for indexing, for instance, `arr(lower:upper)`,
  f2py has to evaluate an expression `upper - lower + 1` where
  `lower` and `upper` are arbitrary expressions of input parameters.
  The evaluation is performed in C, so f2py has to translate Fortran
  expressions to valid C expressions (an alternative approach is
  that a developer specifies the corresponding C expressions in a
  .pyf file).
  
  In the second case, when user provides an input array with a given
  size but some hidden parameters used in dimensions specifications
  need to be determined based on the input array size. This is a
  harder problem because f2py has to solve the inverse problem: find
  a parameter `p` such that `upper(p) - lower(p) + 1` equals to the
  size of input array. In the case when this equation cannot be
  solved (e.g. because the input array size is wrong), raise an
  error before calling the Fortran function (that otherwise would
  likely crash Python process when the size of input arrays is
  wrong). f2py currently supports this case only when the equation
  is linear with respect to unknown parameter.
class_docstr_tok: ["This","test","suite","tests","various","expressions","that","are","used","as","dimension","specifications",".","There","exists","two","usage","cases","where","analyzing","dimensions","specifications","are","important",".","In","the","first","case",",","the","size","of","output","arrays","must","be","defined","based","on","the","inputs","to","a","Fortran","function",".","Because","Fortran","supports","arbitrary","bases","for","indexing",",","for","instance",",","`","arr","(","lower",":","upper",")","`",",","f2py","has","to","evaluate","an","expression","`","upper","-","lower","+","1","`","where","`","lower","`","and","`","upper","`","are","arbitrary","expressions","of","input","parameters",".","The","evaluation","is","performed","in","C",",","so","f2py","has","to","translate","Fortran","expressions","to","valid","C","expressions","(","an","alternative","approach","is","that","a","developer","specifies","the","corresponding","C","expressions","in","a",".pyf","file",")",".","In","the","second","case",",","when","user","provides","an","input","array","with","a","given","size","but","some","hidden","parameters","used","in","dimensions","specifications","need","to","be","determined","based","on","the","input","array","size",".","This","is","a","harder","problem","because","f2py","has","to","solve","the","inverse","problem",":","find","a","parameter","`","p","`","such","that","`","upper","(","p",")","-","lower","(","p",")","+","1","`","equals","to","the","size","of","input","array",".","In","the","case","when","this","equation","can","not","be","solved","(","e.g",".","because","the","input","array","size","is","wrong",")",",","raise","an","error","before","calling","the","Fortran","function","(","that","otherwise","would","likely","crash","Python","process","when","the","size","of","input","arrays","is","wrong",")",".","f2py","currently","supports","this","case","only","when","the","equation","is","linear","with","respect","to","unknown","parameter","."]
code: def test_array_size(self, dimspec):
      count = self.all_dimspecs.index(dimspec)
      get_arr_size = getattr(self.module, f"get_arr_size_{count}")
  
      for n in [1, 2, 3, 4, 5]:
          sz, a = get_arr_size(n)
          assert a.size == sz
  
imports: import importlib
  import codecs
  import time
  import unicodedata
  import pytest
  import numpy
  from numpy.f2py.crackfortran import markinnerspaces, nameargspattern
  from .None import util
  from numpy.f2py import crackfortran
  import textwrap
  import contextlib
  import io
label_desc: Use image node_id 1 for calling the TestDimSpec obj's underlying member method code with example usage: obj.test_array_size(dimspec) without return types