Skip to content

Commit

Permalink
_PY_MAX_VERSION: int = 12
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss committed Oct 1, 2023
1 parent a02aa24 commit ba2c5fd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fail-fast: false
matrix:
py:
- "3.12.0-rc.1"
- "3.12.0-rc.3"
- "3.11"
- "3.10"
- "3.9"
Expand Down
2 changes: 1 addition & 1 deletion src/pyproject_fmt/formatter/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from .config import Config

_PY_MIN_VERSION: int = 7
_PY_MAX_VERSION: int = 11
_PY_MAX_VERSION: int = 12


def _get_max_version_specifier(specifiers: SpecifierSet) -> int | None:
Expand Down
36 changes: 22 additions & 14 deletions tests/formatter/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def test_project_classifiers(fmt: Fmt) -> None:
"Programming Language :: Python :: 3 :: Only",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.8",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.9",
Expand All @@ -56,6 +57,7 @@ def test_project_classifiers(fmt: Fmt) -> None:
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
"""
fmt(fmt_project, start, expected)
Expand Down Expand Up @@ -197,6 +199,7 @@ def test_classifier_gt(fmt: Fmt) -> None:
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
"""
fmt(fmt_project, start, expected)
Expand All @@ -205,19 +208,20 @@ def test_classifier_gt(fmt: Fmt) -> None:
def test_classifier_eq(fmt: Fmt) -> None:
start = """
[project]
requires-python="==3.11"
requires-python="==3.12"
classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
"""
expected = """
[project]
requires-python="==3.11"
requires-python="==3.12"
classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
"""
fmt(fmt_project, start, expected)
Expand All @@ -237,6 +241,7 @@ def test_classifier_neq(fmt: Fmt) -> None:
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
"""
fmt(fmt_project, start, expected)
Expand All @@ -245,18 +250,19 @@ def test_classifier_neq(fmt: Fmt) -> None:
def test_classifier_range(fmt: Fmt) -> None:
start = """
[project]
requires-python=">=3.7,<3.12"
requires-python=">=3.7,<3.13"
"""
expected = """
[project]
requires-python=">=3.7,<3.12"
requires-python=">=3.7,<3.13"
classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
"""
fmt(fmt_project, start, expected)
Expand All @@ -265,16 +271,17 @@ def test_classifier_range(fmt: Fmt) -> None:
def test_classifier_range_neq(fmt: Fmt) -> None:
start = """
[project]
requires-python = "<=3.11,!=3.9,>=3.8"
requires-python = "<=3.12,!=3.9,>=3.8"
"""
expected = """
[project]
requires-python = "<=3.11,!=3.9,>=3.8"
requires-python = "<=3.12,!=3.9,>=3.8"
classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
"""
fmt(fmt_project, start, expected)
Expand Down Expand Up @@ -373,6 +380,7 @@ def test_classifier_gt_tox_no_py_ver(fmt: Fmt, tmp_path: Path) -> None:
classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
"""
fmt(fmt_project, start, expected)
Expand All @@ -381,14 +389,14 @@ def test_classifier_gt_tox_no_py_ver(fmt: Fmt, tmp_path: Path) -> None:
def test_classifier_gt_tox_conf_missing(fmt: Fmt) -> None:
start = """
[project]
requires-python=">=3.11"
requires-python=">=3.12"
"""
expected = """
[project]
requires-python=">=3.11"
requires-python=">=3.12"
classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
"""
fmt(fmt_project, start, expected)
Expand All @@ -402,10 +410,10 @@ def test_classifier_tox_fails_call(fmt: Fmt, mocker: MockerFixture) -> None:

start = """
[project]
requires-python=">=3.11"
requires-python=">=3.12"
classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
"""
fmt(fmt_project, start, start)
Expand All @@ -423,10 +431,10 @@ def test_classifier_tox_exe_bad(

start = """
[project]
requires-python=">=3.11"
requires-python=">=3.12"
classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
"""
fmt(fmt_project, start, start)

0 comments on commit ba2c5fd

Please sign in to comment.