diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0b2cb64c..56910edb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,6 @@ name: test -on: [ push ] +on: [ push, pull_request ] concurrency: group: test-${{ github.head_ref }} @@ -19,18 +19,20 @@ jobs: strategy: matrix: python-version: [3.8, 3.9, "3.10", 3.11, 3.12] - django-version: [4.2, 5.0, "main"] + django-version: [4.2, 5.0, 5.1, "main"] exclude: - # Django 4.2 - - python-version: 3.12 - django-version: 4.2 - # Django 5.0 - python-version: 3.8 django-version: 5.0 - python-version: 3.9 django-version: 5.0 + # Django 5.1 + - python-version: 3.8 + django-version: 5.1 + - python-version: 3.9 + django-version: 5.1 + # Django main - python-version: 3.8 django-version: "main" diff --git a/example/app/views.py b/example/app/views.py index 8b0a0b50..1e7d290e 100644 --- a/example/app/views.py +++ b/example/app/views.py @@ -70,7 +70,7 @@ def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) lines = [] for i in range(200): - lines.append("Line %s" % (i + 1)) + lines.append(f"Line {i + 1}") paginator = Paginator(lines, 10) page = self.request.GET.get("page") try: diff --git a/src/bootstrap4/renderers.py b/src/bootstrap4/renderers.py index dda3fcb6..93f18bb6 100644 --- a/src/bootstrap4/renderers.py +++ b/src/bootstrap4/renderers.py @@ -69,7 +69,7 @@ def parse_size(self, size): return "large" if size in ("md", "medium", ""): return "medium" - raise BootstrapError('Invalid value "%s" for parameter "size" (expected "sm", "md", "lg" or "").' % size) + raise BootstrapError(f'Invalid value "{size}" for parameter "size" (expected "sm", "md", "lg" or "").') def get_size_class(self, prefix="form-control"): if self.size == "small": diff --git a/tests/test_formsets.py b/tests/test_formsets.py index 0f8b2bc0..86791791 100644 --- a/tests/test_formsets.py +++ b/tests/test_formsets.py @@ -27,7 +27,7 @@ def test_field_names(self): self.assertIn('name="datetime_0"', res) self.assertIn('name="datetime_1"', res) else: - self.assertIn('name="%s"' % field.name, res) + self.assertIn(f'name="{field.name}"', res) def test_field_addons(self): form = TestForm() diff --git a/tests/utils.py b/tests/utils.py index 53d0110c..3bd2c3e1 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -39,7 +39,7 @@ def render_form(form=None, context=None): def render_form_field(field, context=None): """Create a template that renders a field.""" - form_field = "form.%s" % field + form_field = f"form.{field}" return render_template_with_form("{% bootstrap_field " + form_field + " %}", context) diff --git a/tox.ini b/tox.ini index 94b9eee6..b40bc702 100644 --- a/tox.ini +++ b/tox.ini @@ -3,9 +3,9 @@ args_are_paths = false envlist = py38-{4.2}, py39-{4.2}, - py310-{4.2,5.0,main}, - py311-{4.2,5.0,main}, - py312-{4.2,5.0,main}, + py310-{4.2,5.0,5.1,main}, + py311-{4.2,5.0,5.1,main}, + py312-{4.2,5.0,5.1,main}, docs, lint, @@ -26,6 +26,7 @@ commands = deps = 4.2: Django==4.2.* 5.0: Django==5.0.* + 5.1: Django==5.1.* main: https://github.com/django/django/archive/main.tar.gz -r{toxinidir}/requirements-test.txt