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

_PY_MAX_VERSION: int = 12 #132

Merged
merged 2 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
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)