def test_floats(self, data): toks = [x for x in lexer.tokenise(data)] self.assertEqual(len(toks), 1) self.assertIsInstance(toks[0], lexer.Float)
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__))
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)
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]))