class LexerTestCase(unittest.TestCase): def setUp(self): self.lexer = HttpPromptLexer() def get_tokens(self, text): tokens = [] for ttype, value in self.lexer.get_tokens(text): if value.strip(): tokens.append((ttype, value)) return tokens
class LexerTestCase(unittest.TestCase): def setUp(self): self.lexer = HttpPromptLexer() def get_tokens(self, text, filter_spaces=True): tokens = self.lexer.get_tokens(text) tokens = filter(lambda t: t[1], tokens) if filter_spaces: tokens = filter(lambda t: t[1].strip(), tokens) return list(tokens)
def setUp(self): self.lexer = HttpPromptLexer()