本文整理汇总了Python中ufora.FORA.python.FORA.makeSymbol方法的典型用法代码示例。如果您正苦于以下问题:Python FORA.makeSymbol方法的具体用法?Python FORA.makeSymbol怎么用?Python FORA.makeSymbol使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ufora.FORA.python.FORA
的用法示例。
在下文中一共展示了FORA.makeSymbol方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: assertValidStringifyAndParse
# 需要导入模块: from ufora.FORA.python import FORA [as 别名]
# 或者: from ufora.FORA.python.FORA import makeSymbol [as 别名]
def assertValidStringifyAndParse(self, foraValue, checkActualValues = False):
resultStr = FORA.makeSymbol("ParsableRepresentation")(foraValue)
try:
result2 = FORA.makeSymbol("ParsableRepresentation")(FORA.eval(resultStr))
except:
self.assertTrue(False,
"Wasn't able to parse:\n**************\n%s\n*************\n\n%s"
% (resultStr, traceback.format_exc())
)
if checkActualValues:
self.assertTrue(
FORA.eval(resultStr) == FORA.eval(result2),
"Printing and parsing %s resulted in %s, which is not the same."
% (resultStr,result2)
)
示例2: generateTestExpressions
# 需要导入模块: from ufora.FORA.python import FORA [as 别名]
# 或者: from ufora.FORA.python.FORA import makeSymbol [as 别名]
def generateTestExpressions():
def isOk(s):
return '"""' not in s and "'''" not in s
testFunctions = ForaValuePrintingTest.generateTestFunctions()
reprSymbol = Fora.makeSymbol("ParsableRepresentation")
tr = [reprSymbol(testFun) for testFun in testFunctions]
return [x for x in tr if isOk(x)]
示例3: assertValidParse
# 需要导入模块: from ufora.FORA.python import FORA [as 别名]
# 或者: from ufora.FORA.python.FORA import makeSymbol [as 别名]
def assertValidParse(self, foraExpressionText, checkActualValues = False):
result1 = FORA.eval(foraExpressionText)
resultStr = FORA.makeSymbol("ParsableRepresentation")(result1)
try:
result2 = FORA.eval(resultStr)
except:
self.assertTrue(False,
"Wasn't able to parse:\n**************\n%s\n*************\n\n%s"
% (result1, traceback.format_exc())
)
if checkActualValues:
self.assertTrue(
result1 == result2,
"Printing and parsing %s resulted in %s, which is not the same"
% (result1, result2)
)