mirror of
https://github.com/django-components/django-components.git
synced 2025-09-26 15:39:08 +00:00
refactor: replace isort, black and flake8 with ruff (#1346)
Some checks are pending
Docs - build & deploy / docs (push) Waiting to run
Run tests / build (ubuntu-latest, 3.10) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.11) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.12) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.13) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.8) (push) Waiting to run
Run tests / test_sampleproject (3.13) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.9) (push) Waiting to run
Run tests / build (windows-latest, 3.10) (push) Waiting to run
Run tests / build (windows-latest, 3.11) (push) Waiting to run
Run tests / build (windows-latest, 3.12) (push) Waiting to run
Run tests / build (windows-latest, 3.13) (push) Waiting to run
Run tests / build (windows-latest, 3.8) (push) Waiting to run
Run tests / build (windows-latest, 3.9) (push) Waiting to run
Run tests / test_docs (3.13) (push) Waiting to run
Some checks are pending
Docs - build & deploy / docs (push) Waiting to run
Run tests / build (ubuntu-latest, 3.10) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.11) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.12) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.13) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.8) (push) Waiting to run
Run tests / test_sampleproject (3.13) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.9) (push) Waiting to run
Run tests / build (windows-latest, 3.10) (push) Waiting to run
Run tests / build (windows-latest, 3.11) (push) Waiting to run
Run tests / build (windows-latest, 3.12) (push) Waiting to run
Run tests / build (windows-latest, 3.13) (push) Waiting to run
Run tests / build (windows-latest, 3.8) (push) Waiting to run
Run tests / build (windows-latest, 3.9) (push) Waiting to run
Run tests / test_docs (3.13) (push) Waiting to run
This commit is contained in:
parent
5279fd372a
commit
f100cc1836
128 changed files with 3076 additions and 2599 deletions
|
@ -1,3 +1,4 @@
|
|||
# ruff: noqa: E501
|
||||
import re
|
||||
from io import StringIO
|
||||
from unittest.mock import patch
|
||||
|
@ -6,6 +7,7 @@ from django.core.management import call_command
|
|||
|
||||
from django_components import Component
|
||||
from django_components.testing import djc_test
|
||||
|
||||
from .testutils import setup_test_config
|
||||
|
||||
setup_test_config({"autodiscover": False})
|
||||
|
@ -41,7 +43,7 @@ class TestComponentListCommand:
|
|||
# Check first line of output
|
||||
assert re.compile(
|
||||
# full_name path
|
||||
r"full_name\s+path\s+"
|
||||
r"full_name\s+path\s+",
|
||||
).search(output.strip().split("\n")[0])
|
||||
|
||||
# Check that the output contains the built-in component
|
||||
|
@ -49,17 +51,17 @@ class TestComponentListCommand:
|
|||
# django_components.components.dynamic.DynamicComponent src/django_components/components/dynamic.py
|
||||
# or
|
||||
# django_components.components.dynamic.DynamicComponent .tox/py311/lib/python3.11/site-packages/django_components/components/dynamic.py
|
||||
r"django_components\.components\.dynamic\.DynamicComponent\s+[\w/\\.-]+django_components{SLASH}components{SLASH}dynamic\.py".format(
|
||||
SLASH=SLASH
|
||||
)
|
||||
r"django_components\.components\.dynamic\.DynamicComponent\s+[\w/\\.-]+django_components{SLASH}components{SLASH}dynamic\.py".format( # noqa: UP032
|
||||
SLASH=SLASH,
|
||||
),
|
||||
).search(output)
|
||||
|
||||
# Check that the output contains the test component
|
||||
assert re.compile(
|
||||
# tests.test_command_list.TestComponentListCommand.test_list_default.<locals>.TestComponent tests/test_command_list.py
|
||||
r"tests\.test_command_list\.TestComponentListCommand\.test_list_default\.<locals>\.TestComponent\s+tests{SLASH}test_command_list\.py".format(
|
||||
SLASH=SLASH
|
||||
)
|
||||
r"tests\.test_command_list\.TestComponentListCommand\.test_list_default\.<locals>\.TestComponent\s+tests{SLASH}test_command_list\.py".format( # noqa: UP032
|
||||
SLASH=SLASH,
|
||||
),
|
||||
).search(output)
|
||||
|
||||
def test_list_all(self):
|
||||
|
@ -86,7 +88,7 @@ class TestComponentListCommand:
|
|||
# Check first line of output
|
||||
assert re.compile(
|
||||
# name full_name path
|
||||
r"name\s+full_name\s+path\s+"
|
||||
r"name\s+full_name\s+path\s+",
|
||||
).search(output.strip().split("\n")[0])
|
||||
|
||||
# Check that the output contains the built-in component
|
||||
|
@ -94,17 +96,17 @@ class TestComponentListCommand:
|
|||
# DynamicComponent django_components.components.dynamic.DynamicComponent src/django_components/components/dynamic.py
|
||||
# or
|
||||
# DynamicComponent django_components.components.dynamic.DynamicComponent .tox/py311/lib/python3.11/site-packages/django_components/components/dynamic.py
|
||||
r"DynamicComponent\s+django_components\.components\.dynamic\.DynamicComponent\s+[\w/\\.-]+django_components{SLASH}components{SLASH}dynamic\.py".format(
|
||||
SLASH=SLASH
|
||||
)
|
||||
r"DynamicComponent\s+django_components\.components\.dynamic\.DynamicComponent\s+[\w/\\.-]+django_components{SLASH}components{SLASH}dynamic\.py".format( # noqa: UP032
|
||||
SLASH=SLASH,
|
||||
),
|
||||
).search(output)
|
||||
|
||||
# Check that the output contains the test component
|
||||
assert re.compile(
|
||||
# TestComponent tests.test_command_list.TestComponentListCommand.test_list_all.<locals>.TestComponent tests/test_command_list.py
|
||||
r"TestComponent\s+tests\.test_command_list\.TestComponentListCommand\.test_list_all\.<locals>\.TestComponent\s+tests{SLASH}test_command_list\.py".format(
|
||||
SLASH=SLASH
|
||||
)
|
||||
r"TestComponent\s+tests\.test_command_list\.TestComponentListCommand\.test_list_all\.<locals>\.TestComponent\s+tests{SLASH}test_command_list\.py".format( # noqa: UP032
|
||||
SLASH=SLASH,
|
||||
),
|
||||
).search(output)
|
||||
|
||||
def test_list_specific_columns(self):
|
||||
|
@ -131,19 +133,19 @@ class TestComponentListCommand:
|
|||
# Check first line of output
|
||||
assert re.compile(
|
||||
# name full_name
|
||||
r"name\s+full_name"
|
||||
r"name\s+full_name",
|
||||
).search(output.strip().split("\n")[0])
|
||||
|
||||
# Check that the output contains the built-in component
|
||||
assert re.compile(
|
||||
# DynamicComponent django_components.components.dynamic.DynamicComponent
|
||||
r"DynamicComponent\s+django_components\.components\.dynamic\.DynamicComponent"
|
||||
r"DynamicComponent\s+django_components\.components\.dynamic\.DynamicComponent",
|
||||
).search(output)
|
||||
|
||||
# Check that the output contains the test component
|
||||
assert re.compile(
|
||||
# TestComponent tests.test_command_list.TestComponentListCommand.test_list_specific_columns.<locals>.TestComponent
|
||||
r"TestComponent\s+tests\.test_command_list\.TestComponentListCommand\.test_list_specific_columns\.<locals>\.TestComponent"
|
||||
r"TestComponent\s+tests\.test_command_list\.TestComponentListCommand\.test_list_specific_columns\.<locals>\.TestComponent",
|
||||
).search(output)
|
||||
|
||||
def test_list_simple(self):
|
||||
|
@ -166,25 +168,28 @@ class TestComponentListCommand:
|
|||
# tests.test_command_list.TestComponentListCommand.test_list_simple.<locals>.TestComponent tests/test_command_list.py
|
||||
|
||||
# Check first line of output is omitted
|
||||
assert re.compile(
|
||||
# full_name path
|
||||
r"full_name\s+path\s+"
|
||||
).search(output.strip().split("\n")[0]) is None
|
||||
assert (
|
||||
re.compile(
|
||||
# full_name path
|
||||
r"full_name\s+path\s+",
|
||||
).search(output.strip().split("\n")[0])
|
||||
is None
|
||||
)
|
||||
|
||||
# Check that the output contains the built-in component
|
||||
assert re.compile(
|
||||
# django_components.components.dynamic.DynamicComponent src/django_components/components/dynamic.py
|
||||
# or
|
||||
# django_components.components.dynamic.DynamicComponent .tox/py311/lib/python3.11/site-packages/django_components/components/dynamic.py
|
||||
r"django_components\.components\.dynamic\.DynamicComponent\s+[\w/\\.-]+django_components{SLASH}components{SLASH}dynamic\.py".format(
|
||||
SLASH=SLASH
|
||||
)
|
||||
r"django_components\.components\.dynamic\.DynamicComponent\s+[\w/\\.-]+django_components{SLASH}components{SLASH}dynamic\.py".format( # noqa: UP032
|
||||
SLASH=SLASH,
|
||||
),
|
||||
).search(output)
|
||||
|
||||
# Check that the output contains the test component
|
||||
assert re.compile(
|
||||
# tests.test_command_list.TestComponentListCommand.test_list_simple.<locals>.TestComponent tests/test_command_list.py
|
||||
r"tests\.test_command_list\.TestComponentListCommand\.test_list_simple\.<locals>\.TestComponent\s+tests{SLASH}test_command_list\.py".format(
|
||||
SLASH=SLASH
|
||||
)
|
||||
r"tests\.test_command_list\.TestComponentListCommand\.test_list_simple\.<locals>\.TestComponent\s+tests{SLASH}test_command_list\.py".format( # noqa: UP032
|
||||
SLASH=SLASH,
|
||||
),
|
||||
).search(output)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue