示例#1
0
 def test_floats(self, data):
     toks = [x for x in lexer.tokenise(data)]
     self.assertEqual(len(toks), 1)
     self.assertIsInstance(toks[0], lexer.Float)
示例#2
0
 def _test_type(self, test_data, typeof, sep = " "):
     data = sep.join(test_data)
     a = [x for x in lexer.tokenise(data)]
     self.assertEqual(len(a), len(test_data))
     for x in a:
         self.assertIsInstance(x, typeof, "{} is not of type {}".format(x, typeof.__name__))
示例#3
0
 def test_exponent_integer(self, data):
     toks = [x for x in lexer.tokenise(data)]
     self.assertEqual(len(toks), 1)
     self.assertIsInstance(toks[0], lexer.Integer)
示例#4
0
 def _test_keywords(self):
     data = " ".join(lexer.keyword_list)
     a = [x for x in lexer.tokenise(data)]
     self.assertEqual(len(a), len(lexer.keyword_list))
     self.assertTrue(all([isinstance(x, lexer.Keyword) for x in a]))