forked from pool/python-prestring
- Add py39.patch to fix tests OBS-URL: https://build.opensuse.org/request/show/889011 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-prestring?expand=0&rev=4
61 lines
1.8 KiB
Diff
61 lines
1.8 KiB
Diff
From 55165f7b1a622577801f8d6c2bd3d0f16555be4b Mon Sep 17 00:00:00 2001
|
|
From: podhmo <ababjam61+github@gmail.com>
|
|
Date: Sun, 28 Mar 2021 14:27:35 +0900
|
|
Subject: [PATCH] Fix test for py39 (#75)
|
|
|
|
* test: remove try-except
|
|
|
|
* test: fix tests (work-around)
|
|
---
|
|
prestring/tests/test_lazy_object.py | 33 +++++++++++++++++------------
|
|
1 file changed, 20 insertions(+), 13 deletions(-)
|
|
|
|
diff --git a/prestring/tests/test_lazy_object.py b/prestring/tests/test_lazy_object.py
|
|
index f528009..a41457f 100644
|
|
--- a/prestring/tests/test_lazy_object.py
|
|
+++ b/prestring/tests/test_lazy_object.py
|
|
@@ -29,23 +29,30 @@ def test_with_actual_types(self):
|
|
self.assertEqual(str(target), "x: int, y: bool, *")
|
|
|
|
def test_with_actual_types2(self):
|
|
- try:
|
|
- import typing as t
|
|
-
|
|
- target = self._makeOne(
|
|
- ["x", "y", "z"],
|
|
- types={
|
|
- "x": int,
|
|
- "y": t.Optional[int],
|
|
- "z": t.Sequence[t.Optional[int]],
|
|
- },
|
|
- )
|
|
+ import typing as t
|
|
+
|
|
+ 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 (3, 9) > sys.version_info:
|
|
self.assertEqual(
|
|
str(target),
|
|
"x: int, y: 'typing.Union[int, NoneType]', z: 'typing.Sequence[typing.Union[int, NoneType]]'",
|
|
)
|
|
- except ImportError:
|
|
- pass
|
|
+ else:
|
|
+ self.assertEqual(
|
|
+ str(target),
|
|
+ "x: int, y: 'typing.Optional[int]', z: 'typing.Sequence[typing.Optional[int]]'",
|
|
+ )
|
|
|
|
|
|
@test_target("prestring:LazyKeywords")
|