本文整理汇总了Python中ufora.FORA.python.FORA.importModule方法的典型用法代码示例。如果您正苦于以下问题:Python FORA.importModule方法的具体用法?Python FORA.importModule怎么用?Python FORA.importModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ufora.FORA.python.FORA
的用法示例。
在下文中一共展示了FORA.importModule方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testModuleStr
# 需要导入模块: from ufora.FORA.python import FORA [as 别名]
# 或者: from ufora.FORA.python.FORA import importModule [as 别名]
def testModuleStr(modulePath, verbose, delay, testFilter, testFunction):
"""parse text in moduleText into a FORA module and execute tests within"""
try:
foraModule = FORA.importModule(modulePath)
except ParseException.ParseException as parseException:
print "Failed to import module %s: %s" % (modulePath, parseException)
return (0, 1)
moduleName = os.path.split(modulePath)[-1]
testNames = extractModuleTestNames(foraModule)
allPassed = 0
allFailed = 0
for testName in testNames:
if testFilter is None or testFilter(modulePath, testName):
time.sleep(delay)
t0 = time.time()
testResults = []
testResultWithTimes = (executeFORATest(foraModule, testName, verbose, testFunction), time.time() - t0)
passed, failed = printTestResults(
moduleName,
testName,
testResultWithTimes,
verbose
)
allPassed += passed
allFailed += failed
return (allPassed, allFailed)
示例2: setUp
# 需要导入模块: from ufora.FORA.python import FORA [as 别名]
# 或者: from ufora.FORA.python.FORA import importModule [as 别名]
def setUp(self):
self.callbackScheduler = CallbackScheduler.singletonForTesting()
self.runtime = Runtime.getMainRuntime()
self.axioms = self.runtime.getAxioms()
self.compiler = self.runtime.getTypedForaCompiler()
self.builtinsAsJOV = FORANative.JudgmentOnValue.Constant(FORA.builtin().implVal_)
pyforaPath = os.path.join(os.path.split(pyfora.__file__)[0], "fora/purePython")
self.purePythonAsJOV = FORANative.JudgmentOnValue.Constant(FORA.importModule(pyforaPath).implVal_)
self.instructionGraph = self.runtime.getInstructionGraph()
self.reasoner = FORANative.SimpleForwardReasoner(self.compiler, self.instructionGraph, self.axioms)
示例3: evalTimingsForModuleMember
# 需要导入模块: from ufora.FORA.python import FORA [as 别名]
# 或者: from ufora.FORA.python.FORA import importModule [as 别名]
def evalTimingsForModuleMember(filename, memberName, callResult = False):
foraModule = FORA.importModule(os.path.join(testPath, filename))
if callResult:
toCall = getattr(foraModule, memberName)
evalFun = lambda n: FORA.eval(
"toCall()",
locals = { 'toCall' : toCall },
parsePath = ["LocalPerfTestRunner"]
)
else:
evalFun = lambda n: FORA.eval(
"foraModule.%s" % memberName,
locals = { 'foraModule' : foraModule },
parsePath = ["LocalPerfTestRunner"]
)
measureTimingsInLoop(evalFun)
示例4: getPerfTestsInLangTests
# 需要导入模块: from ufora.FORA.python import FORA [as 别名]
# 或者: from ufora.FORA.python.FORA import importModule [as 别名]
def getPerfTestsInLangTests(self):
perfTestCases = dict()
metadataForPerfTestCases = dict()
testPath = os.path.split(FORATestModule.__file__)[0]
foraFiles = [x for x in os.listdir(testPath) if x.endswith(".fora")]
for filename in foraFiles:
foraModule = FORA.importModule(os.path.join(testPath, filename))
moduleMembersAndMetadataDict = FORA.objectMembers(foraModule)
for memberName, memberMetadata in moduleMembersAndMetadataDict.iteritems():
if self.isPerfTestCase(memberMetadata):
if filename not in perfTestCases:
perfTestCases[filename] = set()
perfTestCases[filename].add(memberName)
metadataForPerfTestCases[(filename, memberName)] = memberMetadata.outer
return perfTestCases, metadataForPerfTestCases
示例5: generateTestFunctions
# 需要导入模块: from ufora.FORA.python import FORA [as 别名]
# 或者: from ufora.FORA.python.FORA import importModule [as 别名]
def generateTestFunctions():
testFunctions = []
testPath = os.path.split(FORATestModule.__file__)[0]
foraFiles = [x for x in os.listdir(testPath) if x.endswith(".fora")]
foraModules = []
for filename in foraFiles:
foraModules.append(
FORA.extractImplValContainer(
FORA.importModule(
os.path.join(testPath, filename)
)
)
)
for module in foraModules:
for member in module.objectMembers:
expr = module.getMemberDefinition(member)
testFunctions.append(FORA.pythonToFORA(expr.toFunctionImplval(False)))
return testFunctions