Skip to content

Commit

Permalink
TextArea test fixes for 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed Sep 25, 2023
1 parent 4d1f057 commit 92a1a9f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 1 addition & 2 deletions tests/snapshot_tests/language_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,7 @@ def say_hello():
"""

REGEX = """\
^abc # Matches any string that starts with "abc"
REGEX = r"""^abc # Matches any string that starts with "abc"
abc$ # Matches any string that ends with "abc"
^abc$ # Matches the string "abc" and nothing else
a.b # Matches any string containing "a", any character, then "b"
Expand Down
3 changes: 3 additions & 0 deletions tests/snapshot_tests/test_snapshots.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from pathlib import Path

import pytest
Expand Down Expand Up @@ -706,6 +707,7 @@ def test_nested_fr(snap_compare) -> None:
assert snap_compare(SNAPSHOT_APPS_DIR / "nested_fr.py")


@pytest.mark.skipif(sys.version_info < (3, 8), reason="requires python3.8 or higher")
@pytest.mark.parametrize("language", BUILTIN_LANGUAGES)
def test_text_area_language_rendering(language, snap_compare):
# This test will fail if we're missing a snapshot test for a valid
Expand Down Expand Up @@ -757,6 +759,7 @@ def setup_selection(pilot):
)


@pytest.mark.skipif(sys.version_info < (3, 8), reason="requires python3.8 or higher")
@pytest.mark.parametrize("theme_name",
[theme.name for theme in TextAreaTheme.builtin_themes()])
def test_text_area_themes(snap_compare, theme_name):
Expand Down
5 changes: 4 additions & 1 deletion tests/text_area/test_languages.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import sys

import pytest

from textual.app import App, ComposeResult
Expand Down Expand Up @@ -59,13 +61,13 @@ async def test_setting_unknown_language():
text_area.language = "this-language-doesnt-exist"


@pytest.mark.skipif(sys.version_info < (3, 8), reason="requires python3.8 or higher")
async def test_register_language():
app = TextAreaApp()

async with app.run_test():
text_area = app.query_one(TextArea)

# Get the language from py-tree-sitter-languages...
from tree_sitter_languages import get_language

language = get_language("elm")
Expand All @@ -82,6 +84,7 @@ async def test_register_language():
assert text_area.language == "elm"


@pytest.mark.skipif(sys.version_info < (3, 8), reason="requires python3.8 or higher")
async def test_register_language_existing_language():
app = TextAreaApp()
async with app.run_test():
Expand Down

0 comments on commit 92a1a9f

Please sign in to comment.