To check for issues with annotations I ran the typeguard test suite on a build of Python 3.14b1 + some fixes I submitted to CPython but haven't merged yet.
FAILED tests/mypy/test_type_annotations.py::test_positive - subprocess.CalledProcessError: Command '['mypy', '-O', 'json', '--strict', 'positive.py']' returned non-zero exit status 1.
FAILED tests/mypy/test_type_annotations.py::test_negative - AssertionError: assert ''
FAILED tests/test_checkers.py::TestUnion::test_raw_uniontype_fail - AssertionError: Regex pattern did not match.
FAILED tests/test_union_transformer.py::test_union_transformer[str | int-Union[str, int]] - AssertionError: assert 'str | int' == 'Union[str, int]'
FAILED tests/test_union_transformer.py::test_union_transformer[str | int | bytes-Union[str, int, bytes]] - AssertionError: assert 'str | int | bytes' == 'Union[str, int, bytes]'
FAILED tests/test_union_transformer.py::test_union_transformer[str | Union[int | bytes, set]-Union[str, int, bytes, set]] - AssertionError: assert 'str | int | bytes | set' == 'Union[str, int, bytes, set]'
FAILED tests/test_union_transformer.py::test_union_transformer[str | int | Callable[..., bytes]-Union[str, int, Callable[..., bytes]]] - AssertionError: assert 'str | int | ...e[..., bytes]' == 'Union[str, i...[..., bytes]]'
FAILED tests/test_union_transformer.py::test_union_transformer[str | int | Callable[[], bytes]-Union[str, int, Callable[[], bytes]]] - AssertionError: assert 'str | int | ...le[[], bytes]' == 'Union[str, i...e[[], bytes]]'
FAILED tests/test_union_transformer.py::test_union_transformer[str | int | Callable[[], bytes | set]-Union[str, int, Callable[[], Union[bytes, set]]]] - AssertionError: assert 'str | int | ... bytes | set]' == 'Union[str, i...bytes, set]]]'
FAILED tests/test_union_transformer.py::test_union_transformer[str | int | Literal['foo']-Union[str, int, Literal['foo']]] - assert "str | int | Literal['foo']" == "Union[str, i...teral['foo']]"
FAILED tests/test_union_transformer.py::test_union_transformer[str | int | Literal[-1]-Union[str, int, Literal[-1]]0] - AssertionError: assert 'str | int | Literal[-1]' == 'Union[str, int, Literal[-1]]'
FAILED tests/test_union_transformer.py::test_union_transformer[str | int | Literal[-1]-Union[str, int, Literal[-1]]1] - AssertionError: assert 'str | int | Literal[-1]' == 'Union[str, int, Literal[-1]]'
FAILED tests/test_union_transformer.py::test_union_transformer[str | int | Literal["It's a string '\\""]-Union[str, int, Literal['It\\'s a string \\'"']]] - assert 'str | int | ...ring \\\'"\']' == 'Union[str, i...ing \\\'"\']]'
TypeError: AugmentedHelpFormatter.__init__() got an unexpected keyword argument 'prefix_chars'
I might work on fixing these but no guarantees.
Things to check first
I have searched the existing issues and didn't find my bug already reported there
I have checked that my bug is still present in the latest release
Typeguard version
current master
Python version
3.14b1 + some upcoming fixes
What happened?
To check for issues with annotations I ran the typeguard test suite on a build of Python 3.14b1 + some fixes I submitted to CPython but haven't merged yet.
I get these failures:
Most failures are because on 3.14 I unified
typing.Unionandtypes.UnionType, so nowrepr(Union[int, str]) == 'int | str'.The first few are due to argparse changes
I might work on fixing these but no guarantees.
How can we reproduce the bug?
Run tests on 3.14b1