Skip to content
This repository was archived by the owner on Jul 1, 2026. It is now read-only.
Open
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
42 changes: 21 additions & 21 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@v6
- uses: actions/setup-python@v6.2.0
with:
python-version: "3.11"
- uses: pre-commit/action@v3.0.1
Expand All @@ -30,6 +30,8 @@ jobs:
fail-fast: false
matrix:
py:
- "3.14"
- "3.13"
- "3.12"
- "3.11"
- "3.10"
Expand All @@ -40,15 +42,15 @@ jobs:
- "pypy-3.8"

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: setup python for tox
uses: actions/setup-python@v5
uses: actions/setup-python@v6.2.0
with:
python-version: "3.12"
- name: install tox
run: python -m pip install tox
- name: setup python for test ${{ matrix.py }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6.2.0
with:
python-version: ${{ matrix.py }}
- name: Pick environment to run
Expand All @@ -64,26 +66,23 @@ jobs:
run: tox -vv --notest
- name: run test suite for ${{ matrix.py }}
run: tox --skip-pkg-install
- name: Rename coverage report file
run: |
import os; import sys
os.rename(f".tox/.coverage.{os.environ['TOXENV']}", f".tox/.coverage.{os.environ['TOXENV']}-{sys.platform}")
shell: python
- name: Upload coverage data
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v7
with:
name: coverage-data
name: coverage-data-${{ matrix.py }}
path: ".tox/.coverage.*"
include-hidden-files: true
overwrite: true

coverage:
name: Combine coverage
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-python@v5
- uses: actions/setup-python@v6.2.0
with:
python-version: "3.12"
- name: Install tox
Expand All @@ -95,14 +94,15 @@ jobs:
- name: Build package
run: pyproject-build --wheel .
- name: Download coverage data
uses: actions/download-artifact@v3
uses: actions/download-artifact@v7
with:
name: coverage-data
pattern: coverage-data-*
merge-multiple: true
path: .tox
- name: Combine and report coverage
run: tox -e coverage
- name: Upload HTML report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v7
with:
name: html-report
path: .tox/htmlcov
Expand All @@ -118,9 +118,9 @@ jobs:
- docs
- type
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: setup Python "3.12"
uses: actions/setup-python@v5
uses: actions/setup-python@v6.2.0
with:
python-version: "3.12"
- name: install tox
Expand All @@ -134,12 +134,12 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: setup python to build package
uses: actions/setup-python@v5
uses: actions/setup-python@v6.2.0
with:
python-version: "3.12"
- name: install build
run: python -m pip install build
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: build package
run: python -m build --sdist --wheel . -o dist
- name: publish to PyPi
Expand Down
20 changes: 14 additions & 6 deletions tests/test_auto_attribs__py3.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@
None,
0xBAD,
"Value of value 2989 is not of type {}".format(
"typing.Optional[str]"
if sys.version_info == (2, 7) or sys.version_info > (3, 9)
else "typing.Union[str, NoneType]"
"str | None"
if sys.version_info >= (3, 14)
else (
"typing.Optional[str]"
if sys.version_info == (2, 7) or sys.version_info > (3, 9)
else "typing.Union[str, NoneType]"
)
),
),
],
Expand Down Expand Up @@ -75,9 +79,13 @@ def test_recursive():
Self(Self())
Self(Self(None))
type_repr = (
"typing.Optional[test_auto_attribs__py3.Self]"
if sys.version_info == (2, 7) or sys.version_info > (3, 9)
else "typing.Union[test_auto_attribs__py3.Self, NoneType]"
"test_auto_attribs__py3.Self | None"
if sys.version_info >= (3, 14)
else (
"typing.Optional[test_auto_attribs__py3.Self]"
if sys.version_info == (2, 7) or sys.version_info > (3, 9)
else "typing.Union[test_auto_attribs__py3.Self, NoneType]"
)
)
msg = f"Value of parent 17 is not of type {type_repr}"
with pytest.raises(ValueError, match=re.escape(msg)):
Expand Down
18 changes: 14 additions & 4 deletions tests/test_union.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,26 @@
(
2.0,
Union[int, str],
"Value of foo 2.0 is not of type typing.Union[int, str]",
(
"Value of foo 2.0 is not of type {}".format(
"int | str"
if sys.version_info >= (3, 14)
else "typing.Union[int, str]"
)
),
),
(
[1, 2, "p"],
List[Union[None, int]],
(
"Value of foo p is not of type {} in [1, 2, 'p']".format(
"typing.Optional[int]"
if sys.version_info >= (3, 9)
else "typing.Union[NoneType, int]"
"None | int"
if sys.version_info >= (3, 14)
else (
"typing.Optional[int]"
if sys.version_info >= (3, 9)
else "typing.Union[NoneType, int]"
)
)
),
),
Expand Down