def test_repeat2(self): #return # the code below loops for ever. x = LogicVar('x') eq_(eval(and_(set_text('123'), repeat, char(x), unify(x, '4'))), True)
def test_and3(self): assert_raises(NoSolution, eval, and_(succeed, fail))
def test_repeat(self): #return # the code below loops for ever, after modifie the behaviour of solver.parse_state and terminals. x = LogicVar('x') eq_(eval(and_(set_text('123'), repeat, char(x), unify(x, '3'))), True)
def test_and(self): eq_(eval(and_(succeed, succeed)), True)
def test_and2(self): eq_(eval(and_(prin(1), prin(2))), None)
def testnullword2(self): assert_raises(NoSolution, eval, parse_text(and_(nullword, eoi), 'a')) eq_(eval(parse_text(nullword, '')), True)
def testnullword3(self): rule = and_(char('a'), nullword, char('b')) eq_(eval(parse_text(rule, 'ab')), 'b') # passed assert_raises(NoSolution, eval, parse_text(rule, 'a b')) assert_raises(NoSolution, eval, parse_text(rule, 'a'))