def test_highlight_formatter(monkeypatch): monkeypatch.setattr('hubugs.template.pyg_highlight', pyg_side_effect) monkeypatch.setattr('sys.stdout.isatty', lambda: True) result = template.highlight('True', formatter='terminal256') assert isinstance(result.args[2], formatters.terminal256.Terminal256Formatter)
def test_highlight(monkeypatch): monkeypatch.setattr('hubugs.template.pyg_highlight', pyg_side_effect) monkeypatch.setattr('sys.stdout.isatty', lambda: True) result = template.highlight('+++ a\n--- b\n+Test\n') assert isinstance(result.args[1], lexers.DiffLexer) assert isinstance(result.args[2], formatters.terminal.TerminalFormatter)
def test_highlight_lexer(monkeypatch): monkeypatch.setattr('hubugs.template.pyg_highlight', pyg_side_effect) monkeypatch.setattr('sys.stdout.isatty', lambda: True) result = template.highlight('True', 'python') assert isinstance(result.args[1], lexers.PythonLexer)
def test_highlight_formatter(self, pyg_highlight): pyg_highlight.side_effect = self.pyg_side_effect result = template.highlight('True', formatter='terminal256') assert_true(isinstance(result.args[3], formatters.terminal256.Terminal256Formatter))
def test_highlight_lexer(self, pyg_highlight): pyg_highlight.side_effect = self.pyg_side_effect result = template.highlight('True', 'python') assert_true(isinstance(result.args[2], lexers.PythonLexer))
def test_highlight(self, pyg_highlight): pyg_highlight.side_effect = self.pyg_side_effect result = template.highlight('+++ a\n--- b\n+Test\n') assert_true(isinstance(result.args[2], lexers.DiffLexer)) assert_true(isinstance(result.args[3], formatters.terminal.TerminalFormatter))