Example #1
0
 def test_IDENTIFIER(self):
     t = tuple((i.type, i.value) for i in lex('world*'))
     self.assertEqual(t, (
         ("IDENTIFIER", "world*"), ))
Example #2
0
 def test_error(self):
     self.assertRaises(SyntaxError, lambda: tuple(lex("\"hello")))
Example #3
0
 def test_DIGITS(self):
     t = tuple((i.type, i.value) for i in lex('12'))
     self.assertEqual(t, (
         ("DIGITS", "12"), ))
Example #4
0
 def test_SEMICOLON(self):
     t = tuple((i.type, i.value) for i in lex(";;;"))
     self.assertEqual(t, ())
Example #5
0
 def test_QUOTE(self):
     t = tuple((i.type, i.value) for i in lex("'''"))
     self.assertEqual(t, (
         ("QUOTE", "'"), ("QUOTE", "'"), ("QUOTE", "'")))
Example #6
0
 def test_RPAREN(self):
     t = tuple((i.type, i.value) for i in lex(")))"))
     self.assertEqual(t, (
         ("RPAREN", ")"), ("RPAREN", ")"), ("RPAREN", ")")))
Example #7
0
 def test_lineno(self):
     one, two, three = tuple(lex("1\n2\n3\n"))
     self.assertEqual(one.lineno, 1)
     self.assertEqual(two.lineno, 2)
     self.assertEqual(three.lineno, 3)