Skip to content

Commit

Permalink
_PY_MAX_VERSION: int = 12 (#132)
Browse files Browse the repository at this point in the history
Co-authored-by: Bernát Gábor <[email protected]>
  • Loading branch information
cclauss and gaborbernat committed Oct 2, 2023
1 parent 6ce3252 commit 753f844
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
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 753f844

Please sign in to comment.