示例#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)
示例#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)
示例#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)
示例#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))
示例#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))
示例#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))