Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
 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))
Ejemplo n.º 5
0
 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))
Ejemplo n.º 6
0
 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))