Index: prestring-0.9.0/prestring/tests/test_lazy_object.py =================================================================== --- prestring-0.9.0.orig/prestring/tests/test_lazy_object.py +++ prestring-0.9.0/prestring/tests/test_lazy_object.py @@ -29,23 +29,27 @@ class LazyArgumentsTests(unittest.TestCa self.assertEqual(str(target), "x: int, y: bool, *") def test_with_actual_types2(self): - try: - import typing as t + import typing as t - target = self._makeOne( - ["x", "y", "z"], - types={ - "x": int, - "y": t.Optional[int], - "z": t.Sequence[t.Optional[int]], - }, - ) - self.assertEqual( - str(target), - "x: int, y: 'typing.Union[int, NoneType]', z: 'typing.Sequence[typing.Union[int, NoneType]]'", - ) - except ImportError: - pass + target = self._makeOne( + ["x", "y", "z"], + types={ + "x": int, + "y": t.Optional[int], + "z": t.Sequence[t.Optional[int]], + }, + ) + + # TODO: fix, this is work-around + import sys + + if sys.version_info[:2] >= (3, 14): + match = "x: int, y: 'int | None', z: 'typing.Sequence[int | None]'" + elif sys.version_info[:2] > (3, 9): + match = "x: int, y: 'typing.Optional[int]', z: 'typing.Sequence[typing.Optional[int]]'" + else: + match = "x: int, y: 'typing.Union[int, NoneType]', z: 'typing.Sequence[typing.Union[int, NoneType]]'" + self.assertEqual(str(target), match) @test_target("prestring:LazyKeywords")