Skip to content

Commit

Permalink
Init Python3.10 support.
Browse files Browse the repository at this point in the history
  • Loading branch information
hadialqattan committed Oct 15, 2021
1 parent a5f9fb6 commit 1f43c0e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

### Added

- [Add support for Python 3.10](https://github.com/hadialqattan/pycln/pull/81)

### Fixed

- [Parsing local path import with null-pacakge causes AttributeError by @hadialqattan](https://github.com/hadialqattan/pycln/pull/76)
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ classifiers = [
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Utilities"]
license = "MIT"
readme = "README.md"
Expand All @@ -22,7 +23,7 @@ include = ["pyproject.toml"]
pycln = "pycln.cli:app"

[tool.poetry.dependencies]
python = ">=3.6.2, <3.10"
python = ">=3.6.2, <3.11"
typer = "^0.3.1"
toml = "^0.10.1"
dataclasses = {version = "^0.7", python = "3.6"}
Expand Down
21 changes: 20 additions & 1 deletion tests/test_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# Constants.
MOCK = "pycln.utils.scan.%s"
PY38_PLUS = sys.version_info >= (3, 8)
PY310_PLUS = sys.version_info >= (3, 10)


class TestDataclasses:
Expand Down Expand Up @@ -463,6 +464,24 @@ def test_visit_Expr(self, visit_Name, code, expec_names):
),
pytest.param("foobar: '' = 'x'\n", None, id="empty string annotation"),
pytest.param("foobar = 'x'\n", None, id="no string annotation"),
pytest.param(
("def foo(bar: str | int):\n" " pass\n"),
{"str", "int"},
id="union types - arg",
marks=pytest.mark.skipif(
not PY310_PLUS,
reason="This feature is only available in Python >=3.10.",
),
),
pytest.param(
("def foo() -> str | int :\n" " pass\n"),
{"str", "int"},
id="union types - return",
marks=pytest.mark.skipif(
not PY310_PLUS,
reason="This feature is only available in Python >=3.10.",
),
),
],
)
@mock.patch(MOCK % "SourceAnalyzer.visit_Name")
Expand All @@ -473,7 +492,7 @@ def test_visit_string_type_annotation(self, visit_Name, code, expec_names):

@pytest.mark.skipif(
not PY38_PLUS,
reason="This feature is only available for Python >=3.8.",
reason="This feature is only available in Python >=3.8.",
)
@pytest.mark.parametrize(
"code, expec_names",
Expand Down

0 comments on commit 1f43c0e

Please sign in to comment.