Source code for UseCases.PySourceInfo.getCallerNamespaceLocal.CallCase
"""Check defaults.
"""
from __future__ import absolute_import
import unittest
import os
import pysourceinfo.PySourceInfo
#
#######################
#
[docs]class CallUnits(unittest.TestCase):
[docs] def testCase000(self):
import sys
_s = sys.path[:]
sys.path.insert(0,os.path.abspath(os.path.dirname(__file__)+os.sep+'..'))
import PySourceInfo_check #@UnresolvedImport
fx = PySourceInfo_check.check_callback(pysourceinfo.PySourceInfo.getCallerNamespaceLocal,0)
fx = fx['spos']
[ sys.path.pop() for x in range(len(sys.path)) ] #@UnusedVariable
sys.path.extend(_s)
assert fx == 0
[docs] def testCase001(self):
import sys
_s = sys.path[:]
sys.path.insert(0,os.path.abspath(os.path.dirname(__file__)+os.sep+'..'))
import PySourceInfo_check #@UnresolvedImport
fx = PySourceInfo_check.check_callback(pysourceinfo.PySourceInfo.getCallerNamespaceLocal,1)
fx = fx['fct'].func_name
[ sys.path.pop() for x in range(len(sys.path)) ] #@UnusedVariable
sys.path.extend(_s)
assert fx == 'getCallerNamespaceLocal'
[docs] def testCase002(self):
import sys
_s = sys.path[:]
sys.path.insert(0,os.path.abspath(os.path.dirname(__file__)+os.sep+'..'))
import PySourceInfo_check #@UnresolvedImport
fx = PySourceInfo_check.check_callback(pysourceinfo.PySourceInfo.getCallerNamespaceLocal,2)
fx = fx['PySourceInfo_check']
[ sys.path.pop() for x in range(len(sys.path)) ] #@UnusedVariable
sys.path.extend(_s)
assert fx == PySourceInfo_check
[docs] def testCase003(self):
import sys
_s = sys.path[:]
sys.path.insert(0,os.path.abspath(os.path.dirname(__file__)+os.sep+'..'))
import PySourceInfo_check #@UnresolvedImport
fx = PySourceInfo_check.check_callback(pysourceinfo.PySourceInfo.getCallerNamespaceLocal,3)
fx = fx['self']
[ sys.path.pop() for x in range(len(sys.path)) ] #@UnusedVariable
sys.path.extend(_s)
assert fx == self
if __name__ == '__main__':
unittest.main()