parameters: (filename)
docstring: when we call the EOS with something other than eos_input_rt, we need to make sure that eos_state % rho and eos_state % T are both defined (possibly with reasonable guesses) to ensure Newton is happy.
docstring_summary: when we call the EOS with something other than eos_input_rt, we need to make sure that eos_state % rho and eos_state % T are both defined (possibly with reasonable guesses) to ensure Newton is happy.
docstring_tokens: when we call the EOS with something other than eos_input_rt we need to make sure that eos_state % rho and eos_state % T are both defined ( possibly with reasonable guesses ) to ensure Newton is happy .
function: def test_check_eos_inputs(filename):
      """
      when we call the EOS with something other than eos_input_rt, we need to make sure that eos_state % rho and eos_state % T are both defined (possibly with reasonable guesses) to ensure Newton is happy.
      """
  
      with open(filename, 'r') as file_dat:
          r = re.compile(r'(?:subroutine|function)(.*?)end (?:subroutine|function)', re.M | re.S)
  
          for m in re.finditer(r, file_dat.read()):
              # does it contain an EOS call with something other than `eos_input_rt`?
              s = re.compile(r' eos\(eos_input_([a-z]{2}),\s?(\w+)\s?\)')
              function_body = m.group(1)
  
              for n in re.finditer(s, function_body):
                  if n.group(1) != 'rt':
                      # now we need to check that rho and T are both defined
                      # NOTE: this bit is not clever enough to be able to deal with 
                      # branches. It's just checking that somewhere in the routine 
                      # prior to the EOS call, rho and T were set
                      try:
                          assert re.search(re.compile(fr'{n.group(2)}\s?%\s?rho\s*='), function_body[:n.start()]) is not None
                          assert re.search(re.compile(fr'{n.group(2)}\s?%\s?T\s*='), function_body[:n.start()]) is not None
                      except AssertionError:
                          # it might be that the state is burned, in which case 
                          # the state being initialized will have a different 
                          # name to the one having the eos called on it
                          assert re.search(re.compile(fr'%\s?rho\s*='), function_body[:n.start()]) is not None
                          assert re.search(re.compile(fr'%\s?T\s*='), function_body[:n.start()]) is not None
function_tokens: def test_check_eos_inputs ( filename ) : with open ( filename , 'r' ) as file_dat : r = re . compile ( r'(?:subroutine|function)(.*?)end (?:subroutine|function)' , re . M | re . S ) for m in re . finditer ( r , file_dat . read ( ) ) : # does it contain an EOS call with something other than `eos_input_rt`? s = re . compile ( r' eos\(eos_input_([a-z]{2}),\s?(\w+)\s?\)' ) function_body = m . group ( 1 ) for n in re . finditer ( s , function_body ) : if n . group ( 1 ) != 'rt' : # now we need to check that rho and T are both defined # NOTE: this bit is not clever enough to be able to deal with  # branches. It's just checking that somewhere in the routine  # prior to the EOS call, rho and T were set try : assert re . search ( re . compile ( fr'{n.group(2)}\s?%\s?rho\s*=' ) , function_body [ : n . start ( ) ] ) is not None assert re . search ( re . compile ( fr'{n.group(2)}\s?%\s?T\s*=' ) , function_body [ : n . start ( ) ] ) is not None except AssertionError : # it might be that the state is burned, in which case  # the state being initialized will have a different  # name to the one having the eos called on it assert re . search ( re . compile ( fr'%\s?rho\s*=' ) , function_body [ : n . start ( ) ] ) is not None assert re . search ( re . compile ( fr'%\s?T\s*=' ) , function_body [ : n . start ( ) ] ) is not None