diff options
Diffstat (limited to 'Lib/test')
| -rwxr-xr-x | Lib/test/regrtest.py | 9 | ||||
| -rw-r--r-- | Lib/test/test_asyncio/test_subprocess.py | 6 | ||||
| -rw-r--r-- | Lib/test/test_http_cookiejar.py | 9 | ||||
| -rw-r--r-- | Lib/test/test_typing.py | 24 |
4 files changed, 42 insertions, 6 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 5b1fcc6..5650be0 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -810,7 +810,7 @@ def main(tests=None, **kwargs): if ns.verbose2 and bad: print("Re-running failed tests in verbose mode") - for test in bad: + for test in bad[:]: print("Re-running test %r in verbose mode" % test) sys.stdout.flush() try: @@ -821,6 +821,13 @@ def main(tests=None, **kwargs): # print a newline separate from the ^C print() break + else: + if ok[0] in {PASSED, ENV_CHANGED, SKIPPED, RESOURCE_DENIED}: + bad.remove(test) + else: + if bad: + print(count(len(bad), 'test'), "failed again:") + printlist(bad) if ns.single: if next_single_test: diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py index 38f0cee..d138c26 100644 --- a/Lib/test/test_asyncio/test_subprocess.py +++ b/Lib/test/test_asyncio/test_subprocess.py @@ -417,11 +417,7 @@ class SubprocessMixin: def test_popen_error(self): # Issue #24763: check that the subprocess transport is closed # when BaseSubprocessTransport fails - if sys.platform == 'win32': - target = 'asyncio.windows_utils.Popen' - else: - target = 'subprocess.Popen' - with mock.patch(target) as popen: + with mock.patch('subprocess.Popen') as popen: exc = ZeroDivisionError popen.side_effect = exc diff --git a/Lib/test/test_http_cookiejar.py b/Lib/test/test_http_cookiejar.py index e9f0356..50260ff 100644 --- a/Lib/test/test_http_cookiejar.py +++ b/Lib/test/test_http_cookiejar.py @@ -566,6 +566,15 @@ class CookieTests(unittest.TestCase): self.assertEqual(len(c), 1) self.assertIn('spam="bar"', h) + # test if fractional expiry is accepted + cookie = Cookie(0, "name", "value", + None, False, "www.python.org", + True, False, "/", + False, False, "1444312383.018307", + False, None, None, + {}) + self.assertEqual(cookie.expires, 1444312383) + # XXX RFC 2965 expiry rules (some apply to V0 too) def test_default_path(self): diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index 2bb21ed..b34007d 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -459,6 +459,14 @@ class CallableTests(TestCase): ctv = Callable[..., str] self.assertEqual(repr(ctv), 'typing.Callable[..., str]') + def test_callable_with_ellipsis(self): + + def foo(a: Callable[..., T]): + pass + + self.assertEqual(get_type_hints(foo, globals(), locals()), + {'a': Callable[..., T]}) + XK = TypeVar('XK', str, bytes) XV = TypeVar('XV') @@ -555,6 +563,14 @@ class GenericTests(TestCase): with self.assertRaises(TypeError): Y[str, bytes] + def test_init(self): + T = TypeVar('T') + S = TypeVar('S') + with self.assertRaises(TypeError): + Generic[T, T] + with self.assertRaises(TypeError): + Generic[T, S, T] + def test_repr(self): self.assertEqual(repr(SimpleMapping), __name__ + '.' + 'SimpleMapping[~XK, ~XV]') @@ -801,6 +817,14 @@ class ForwardRefTests(TestCase): self.assertEqual(get_type_hints(foo, globals(), locals()), {'a': Callable[[T], T]}) + def test_callable_with_ellipsis_forward(self): + + def foo(a: 'Callable[..., T]'): + pass + + self.assertEqual(get_type_hints(foo, globals(), locals()), + {'a': Callable[..., T]}) + def test_syntax_error(self): with self.assertRaises(SyntaxError): |
