diff --git a/example-code/document.md b/example-code/document.md new file mode 100644 index 0000000..d1b246b --- /dev/null +++ b/example-code/document.md @@ -0,0 +1,22 @@ +# Example MarkDown Document + +## Heading two + +Not much to see here. + +Except some ~~deleted text~~ using the [CommonMark](https://commonmark.org/) +flavour. + +## Python code example + +This is a simple Python code example: +```python +class MyClass: + "An uncomplicated class." + + def __init__(self): + pass +``` + +### Heading three +That's it. diff --git a/falconry_pygments_theme/dark.py b/falconry_pygments_theme/dark.py index 6ee6ed2..84bf802 100644 --- a/falconry_pygments_theme/dark.py +++ b/falconry_pygments_theme/dark.py @@ -13,25 +13,25 @@ # limitations under the License. from pygments.style import Style -from pygments.token import ( - Comment, - Error, - Generic, - Keyword, - Name, - Number, - Operator, - String, - Token, -) +from pygments.token import Comment +from pygments.token import Error +from pygments.token import Generic +from pygments.token import Keyword +from pygments.token import Name +from pygments.token import Number +from pygments.token import Operator +from pygments.token import String +from pygments.token import Token -from .common import bold, italic, bold_italic +from .common import bold +from .common import bold_italic +from .common import italic class Colors: yellow = '#ffc66d' - orange = '#c26230' - crimson = '#dc143c' + orange = '#df5a1f' + crimson = '#ed3b5f' brown = '#bc9458' green = '#a5c261' pear = '#c9cc3f' diff --git a/falconry_pygments_theme/light.py b/falconry_pygments_theme/light.py index 6a6dd32..4991e0a 100644 --- a/falconry_pygments_theme/light.py +++ b/falconry_pygments_theme/light.py @@ -13,19 +13,19 @@ # limitations under the License. from pygments.style import Style -from pygments.token import ( - Comment, - Error, - Generic, - Keyword, - Name, - Number, - Operator, - String, - Token, -) +from pygments.token import Comment +from pygments.token import Error +from pygments.token import Generic +from pygments.token import Keyword +from pygments.token import Name +from pygments.token import Number +from pygments.token import Operator +from pygments.token import String +from pygments.token import Token -from .common import bold, italic, bold_italic +from .common import bold +from .common import bold_italic +from .common import italic class Colors: diff --git a/pyproject.toml b/pyproject.toml index 27102ad..f65e1ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,3 +49,29 @@ license-files = ["LICENSE"] target-version = "py38" format.quote-style = "single" line-length = 79 + +[tool.ruff.lint] +select = [ + "C9", + "E", + "F", + "W", + "I" +] + +[tool.ruff.lint.mccabe] +max-complexity = 15 + +[tool.ruff.lint.isort] +case-sensitive = false +force-single-line = true +order-by-type = false +single-line-exclusions = [ + "typing", +] +force-sort-within-sections = true + +[tool.pytest] +testpaths = [ + "tests", +] diff --git a/tests/test_dark.py b/tests/test_dark.py new file mode 100644 index 0000000..a19d19d --- /dev/null +++ b/tests/test_dark.py @@ -0,0 +1,13 @@ +import pytest + +from falconry_pygments_theme.dark import Colors +from falconry_pygments_theme.dark import FalconryDarkStyle + +_color_names = sorted(name for name in dir(Colors) if not name.startswith('_')) + + +@pytest.mark.parametrize('color_name', _color_names) +def test_contrast(contrast, color_name): + value = getattr(Colors, color_name) + if value != FalconryDarkStyle.background_color: + assert contrast(value, FalconryDarkStyle.background_color) >= 'AA' diff --git a/tests/test_light.py b/tests/test_light.py index 15c08a4..c5fb95b 100644 --- a/tests/test_light.py +++ b/tests/test_light.py @@ -1,16 +1,13 @@ import pytest from falconry_pygments_theme.light import Colors +from falconry_pygments_theme.light import FalconryLightStyle - -_color_names = sorted( - name - for name in dir(Colors) - if not (name.startswith('_') or name == 'light') -) +_color_names = sorted(name for name in dir(Colors) if not name.startswith('_')) @pytest.mark.parametrize('color_name', _color_names) def test_contrast(contrast, color_name): value = getattr(Colors, color_name) - assert contrast(value, Colors.light) >= 'AA' + if value != FalconryLightStyle.background_color: + assert contrast(value, FalconryLightStyle.background_color) >= 'AA' diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..5a37743 --- /dev/null +++ b/tox.ini @@ -0,0 +1,17 @@ +[tox] + +envlist = ruff, py + +[testenv] +deps = + pytest +commands = + pytest -v tests/ [] + +[testenv:ruff] +deps = + ruff +skip_install = True +commands = + ruff check + ruff format --check