Source code for tests.30_libs.040_PySourceInfo.getCallerNameOID.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[:]
_sx = repr(sys.path)
sys.path.insert(0,os.path.dirname(__file__)+os.sep+'..')
import PySourceInfo_check_tests #@UnresolvedImport
fx = PySourceInfo_check_tests.check_callback(pysourceinfo.PySourceInfo.getCallerNameOID,0)
assert fx == 'pysourceinfo.PySourceInfo.getCallerNameOID'
assert _sx != repr(sys.path)
sys.path.pop(0)
assert _sx == repr(sys.path)
[ sys.path.pop() for x in range(len(sys.path)) ] #@UnusedVariable
sys.path.extend(_s)
[docs] def testCase001(self):
import sys
_s=sys.path[:]
_sx = repr(sys.path)
sys.path.insert(0,os.path.dirname(__file__)+os.sep+'..')
import PySourceInfo_check_tests #@UnresolvedImport
fx0 = 'tests.30_libs.040_PySourceInfo.PySourceInfo_check_tests.check_callback'
fx1 = 'PySourceInfo_check_tests.check_callback'
fx = PySourceInfo_check_tests.check_callback(pysourceinfo.PySourceInfo.getCallerNameOID,1)
assert fx == fx0 or fx == fx1
assert _sx != repr(sys.path)
sys.path.pop(0)
assert _sx == repr(sys.path)
[ sys.path.pop() for x in range(len(sys.path)) ] #@UnusedVariable
sys.path.extend(_s)
[docs] def testCase002(self):
import sys
_s=sys.path[:]
_sx = repr(sys.path)
sys.path.insert(0,os.path.dirname(__file__)+os.sep+'..')
import PySourceInfo_check_tests #@UnresolvedImport
fx0 = 'tests.30_libs.040_PySourceInfo.getCallerNameOID.CallCase.CallUnits.testCase002'
fx1 = '30_libs.040_PySourceInfo.getCallerNameOID.CallCase.CallUnits.testCase002'
fx = PySourceInfo_check_tests.check_callback(pysourceinfo.PySourceInfo.getCallerNameOID,2)
assert fx == fx0 or fx == fx1
assert _sx != repr(sys.path)
sys.path.pop(0)
assert _sx == repr(sys.path)
[ sys.path.pop() for x in range(len(sys.path)) ] #@UnusedVariable
sys.path.extend(_s)
[docs] def testCase003(self):
import sys
_s=sys.path[:]
_sx = repr(sys.path)
sys.path.insert(0,os.path.dirname(__file__)+os.sep+'..')
import PySourceInfo_check_tests #@UnresolvedImport
fx = PySourceInfo_check_tests.check_callback(pysourceinfo.PySourceInfo.getCallerNameOID,3)
version = '{0}.{1}'.format(*sys.version_info[:2])
if version == '2.6': # pragma: no cover
assert fx == 'unittest.CallUnits.run'
elif version == '2.7': # pragma: no cover
assert fx == 'unittest.case.CallUnits.run'
else:
assert False
assert _sx != repr(sys.path)
sys.path.pop(0)
assert _sx == repr(sys.path)
[ sys.path.pop() for x in range(len(sys.path)) ] #@UnusedVariable
sys.path.extend(_s)
if __name__ == '__main__':
unittest.main()