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
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