Files
superqt/tests/test_code_highlight.py
Grzegorz Bokota 0ae3350c57 Add code syntax highlight utils (#88)
* add code syntax highlight code

* add example

* add documentation and fix example

* add tests

* add information about napari theme usage

* clean napari mention
2022-05-18 16:50:51 -04:00

20 lines
644 B
Python

from qtpy.QtWidgets import QTextEdit
from superqt.utils import CodeSyntaxHighlight
def test_code_highlight(qtbot):
widget = QTextEdit()
qtbot.addWidget(widget)
code_highlight = CodeSyntaxHighlight(widget, "python", "default")
assert code_highlight.background_color == "#f8f8f8"
widget.setText("from argparse import ArgumentParser")
def test_code_highlight_by_name(qtbot):
widget = QTextEdit()
qtbot.addWidget(widget)
code_highlight = CodeSyntaxHighlight(widget, "Python Traceback", "monokai")
assert code_highlight.background_color == "#272822"
widget.setText("from argparse import ArgumentParser")