Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Oct 3, 2020
1 parent d1f6b52 commit 5403640
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions tests/test_syntax.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# coding=utf-8

import sys
import os, tempfile

import pytest
from .render import render

from rich.panel import Panel
from rich.style import Style
from rich.syntax import Syntax, ANSISyntaxTheme


CODE = '''
def loop_first_last(values: Iterable[T]) -> Iterable[Tuple[bool, bool, T]]:
"""Iterate and generate a tuple with a flag for first and last value."""
Expand All @@ -16,14 +27,6 @@ def loop_first_last(values: Iterable[T]) -> Iterable[Tuple[bool, bool, T]]:
yield first, True, previous_value
'''

import os, tempfile

from .render import render

from rich.panel import Panel
from rich.style import Style
from rich.syntax import Syntax, ANSISyntaxTheme


def test_python_render():
syntax = Panel.fit(
Expand All @@ -50,6 +53,7 @@ def test_ansi_theme():
assert theme.get_background_style() == Style()


@pytest.mark.skipif(sys.platform == "win32", reason="permissions error on Windows")
def test_from_file():
fh, path = tempfile.mkstemp("example.py")
try:
Expand All @@ -61,6 +65,7 @@ def test_from_file():
os.remove(path)


@pytest.mark.skipif(sys.platform == "win32", reason="permissions error on Windows")
def test_from_file_unknown_lexer():
fh, path = tempfile.mkstemp("example.nosuchtype")
try:
Expand Down

0 comments on commit 5403640

Please sign in to comment.