本文整理汇总了Python中freeode.interpreter.Interpreter.create_path方法的典型用法代码示例。如果您正苦于以下问题:Python Interpreter.create_path方法的具体用法?Python Interpreter.create_path怎么用?Python Interpreter.create_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类freeode.interpreter.Interpreter
的用法示例。
在下文中一共展示了Interpreter.create_path方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_Interpreter_create_path_2
# 需要导入模块: from freeode.interpreter import Interpreter [as 别名]
# 或者: from freeode.interpreter.Interpreter import create_path [as 别名]
def test_Interpreter_create_path_2(): #IGNORE:C01111
msg = 'Interpreter: create_path method: return existing path, extend path'
#skip_test(msg)
print msg
from freeode.interpreter import InterpreterObject, Interpreter
from freeode.util import DotName
#create an interpreter
intp = Interpreter()
#the root object where the long name will be created
root = InterpreterObject()
#create all attributes so that this dotname can be looked up
#o_name_1 should be the object representing the rightmost element (name)
o_name_1 = intp.create_path(root, DotName('this.is_.a.long.dotted.name'))
#access existing path, don't try to create it twice
o_name_2 = intp.create_path(root, DotName('this.is_.a.long.dotted.name'))
assert o_name_1 is o_name_2
#extend existing path
o_indeed = intp.create_path(root, DotName('this.is_.a.long.dotted.name.indeed'))
o_indeed_2 = o_name_1.indeed #pylint:disable-msg=E1103
assert o_indeed is o_indeed_2
示例2: test_Interpreter_create_path_1
# 需要导入模块: from freeode.interpreter import Interpreter [as 别名]
# 或者: from freeode.interpreter.Interpreter import create_path [as 别名]
def test_Interpreter_create_path_1(): #IGNORE:C01111
msg = 'Interpreter: create_path method: create non-existing path.'
#skip_test(msg)
print msg
from freeode.interpreter import InterpreterObject, Interpreter
from freeode.util import DotName
#create an interpreter
intp = Interpreter()
#the root object where the long name will be created
root = InterpreterObject()
#create all attributes so that this dotname can be looked up
#o_name_1 should be the object representing the rightmost element (name)
o_name_1 = intp.create_path(root, DotName('this.is_.a.long.dotted.name'))
#see if all attributes have been created
o_name_2 = root.this.is_.a.long.dotted.name #pylint:disable-msg=E1101
#the create_path function must return the final element
assert o_name_1 is o_name_2