Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextArea test fixes for 3.7 #3397

Merged
merged 5 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
darrenburns marked this conversation as resolved.
Show resolved Hide resolved
@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")
darrenburns marked this conversation as resolved.
Show resolved Hide resolved
@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")
darrenburns marked this conversation as resolved.
Show resolved Hide resolved
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")
darrenburns marked this conversation as resolved.
Show resolved Hide resolved
async def test_register_language_existing_language():
app = TextAreaApp()
async with app.run_test():
Expand Down
Loading