class_docstr: Test environment to validate a pythran execution against python. 
class_docstr_tok: ["Test","environment","to","validate","a","pythran","execution","against","python","."]
docstr: Test if a function call return value is equal for Pythran and Pythran.
  
  Args:
     code (str):  python (pythran valid) module to test.
     module_name (str): name of the compiled module
     runas (str): command line to run to check output
     interface (dict): pythran interface for the module to test.
                       Each key is the name of a function to call,
                       the value is a list of the arguments' type.
  
  Returns: nothing.
  
  Raises:
     AssertionError by 'unittest' if return value differ.
     SyntaxError if code is not python valid.
     pythran.CompileError if generated code can't be compiled.
     ...possibly others...
docstr_tok: ["Test","if","a","function","call","return","value","is","equal","for","Pythran","and","Pythran",".","Args",":","code","(","str",")",":","python","(","pythran","valid",")","module","to","test",".","module_name","(","str",")",":","name","of","the","compiled","module","runas","(","str",")",":","command","line","to","run","to","check","output","interface","(","dict",")",":","pythran","interface","for","the","module","to","test",".","Each","key","is","the","name","of","a","function","to","call",",","the","value","is","a","list","of","the","arguments","'","type",".","Returns",":","nothing",".","Raises",":","AssertionError","by","'unittest","'","if","return","value","differ",".","SyntaxError","if","code","is","not","python","valid",".","pythran.CompileError","if","generated","code","ca","n't","be","compiled",".","...","possibly","others","..."]
code: def run_test_case(
      self, code, module_name, runas, module_dir=None, **interface
  ):
      """
      Test if a function call return value is equal for Pythran and Pythran.
  
      Args:
         code (str):  python (pythran valid) module to test.
         module_name (str): name of the compiled module
         runas (str): command line to run to check output
         interface (dict): pythran interface for the module to test.
                           Each key is the name of a function to call,
                           the value is a list of the arguments' type.
  
      Returns: nothing.
  
      Raises:
         AssertionError by 'unittest' if return value differ.
         SyntaxError if code is not python valid.
         pythran.CompileError if generated code can't be compiled.
         ...possibly others...
      """
      # Extract special keys from interface.
      if runas:
          # runas is a python code string to run the test. By convention
          # the last statement of the sequence is the value to test.
          # We insert ourselves a variable to capture this value:
          # "a=1; b=2; myfun(a+b,a-b)" => "a=1; b=2; RES=myfun(a+b,a-b)"
          runas_commands = runas.split(";")
          begin = ";".join(runas_commands[:-1])
          # this tests the runas initialisation syntax
          exec(code + "\n" + begin, {})
          last = self.TEST_RETURNVAL + "=" + runas_commands[-1]
          runas = begin + "\n" + last
  
      # We run test for each exported function (not for each possible
      # signature.
      for i, name in enumerate(sorted(interface.keys())):
          # If no module name was provided, create one
          modname = (module_name or ("test_" + name)) + str(i)
  
          # Compile the code using pythran
          cxx_compiled = compile_pythrancode(
              modname,
              code,
              interface,
              module_dir=module_dir,
              extra_compile_args=self.PYTHRAN_CXX_FLAGS,
          )
  
          if not runas:
              continue
  
          python_ref = self.run_python(code, runas)
          pythran_res = self.run_pythran(modname, cxx_compiled, runas)
          self.cleanup_pythran(cxx_compiled)
  
          print("Python result: ", python_ref)
          print("Pythran result: ", pythran_res)
          harmonize_containers(python_ref)
          self.assertAlmostEqual(python_ref, pythran_res)
  
imports: import importlib
  from numpy import float32, float64, complex128
  from numpy import intp, intc, number, bool_
  from numpy import ndarray, isnan, isinf, isneginf, complex128, complex64
  from textwrap import dedent
  from threading import Thread
  import copy
  import math
  import glob
  import numpy.testing
  import os
  import numbers
  import sys
  import unittest
  from functools import reduce
  from operator import add
  import logging
  from pythran import compile_pythrancode, spec_parser, load_specfile, frontend
  from pythran.backend import Python
  from pythran.middlend import refine
  from pythran.passmanager import PassManager
  from pythran.toolchain import _parse_optimization
  from pythran.spec import Spec
label_desc: Use image node_id 6 for calling the TestEnv obj's underlying member method code with example usage: obj.run_test_case(code, module_name, runas, module_dir) without return types