def testRuleNamesWithAscentAndDescent(self): self.rules = [ Rule("aaaaa", NonTerminal("ascent and descent")), Rule("ppppp", NonTerminal("should")), Rule("ddddd", NonTerminal("look")), Rule("dddpp", NonTerminal("right")) ]
def testRestrictionWithLongerException(self): self.rules = [ Rule( "restriction", Restriction(Terminal("base"), Terminal("long exception branch"))) ]
def testRestrictionWithShorterException(self): self.rules = [ Rule( "restriction", Restriction(Terminal("long base branch"), Terminal("exception"))) ]
def testRepetitionWithLongBackwardBranch(self): self.rules = [ Rule( "repetition", Repetition(Terminal("forward"), Terminal("backward branch is longer"))) ]
def testSequence(self): self.rules = [ Rule( "sequence", Sequence([ NonTerminal("with"), NonTerminal("one"), NonTerminal("branch") ])) ]
def testAlternative(self): self.rules = [ Rule( "alternative", Alternative([ NonTerminal("with"), NonTerminal("several"), NonTerminal("branches") ])) ]
def testNull(self): self.rules = [ Rule( "sequence with null", Sequence([ Terminal("space here ->"), Null, Terminal("should be like here ->"), Terminal("foo") ])) ]
def testImbricatedRepetitions(self): self.rules = [ Rule( "repetition", Repetition( Repetition(NonTerminal("forward 1"), NonTerminal("backward 1")), Repetition(NonTerminal("forward 2"), NonTerminal("backward 2")))) ]
def testBackwardAlternative(self): self.rules = [ Rule( "repetition", Repetition( NonTerminal("forward"), Alternative([ NonTerminal("foo"), NonTerminal("bar"), NonTerminal("baz") ]))) ]
def testAlternativeWithOneBranch(self): self.rules = [ Rule("alternative", Alternative([NonTerminal("with one branch")])) ]
def testLongRuleName(self): self.rules = [ Rule("this long rule name should not be truncated", NonTerminal("foo")), ]
def testTerminal(self): self.rules = [Rule("terminal", Terminal("in a rounded rectangle"))]
def testNonTerminal(self): self.rules = [Rule("non terminal", NonTerminal("in a rectangle"))]