We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4fcbe2e commit 74d8343Copy full SHA for 74d8343
src/future/moves/test/support.py
@@ -1,9 +1,18 @@
1
from __future__ import absolute_import
2
+
3
+import sys
4
5
from future.standard_library import suspend_hooks
6
from future.utils import PY3
7
8
if PY3:
9
from test.support import *
10
+ if sys.version_info[:2] >= (3, 10):
11
+ from test.support.os_helper import (
12
+ EnvironmentVarGuard,
13
+ TESTFN,
14
+ )
15
+ from test.support.warnings_helper import check_warnings
16
else:
17
__future_module__ = True
18
with suspend_hooks():
tests/test_future/test_builtins.py
@@ -1303,8 +1303,11 @@ def test_pow(self):
1303
self.assertAlmostEqual(pow(-1, 0.5), 1j)
1304
self.assertAlmostEqual(pow(-1, 1/3), 0.5 + 0.8660254037844386j)
1305
1306
- # Raises TypeError in Python < v3.5, ValueError in v3.5:
1307
- self.assertRaises((TypeError, ValueError), pow, -1, -2, 3)
+ # Raises TypeError in Python < v3.5, ValueError in v3.5-v3.7:
+ if sys.version_info[:2] < (3, 8):
1308
+ self.assertRaises((TypeError, ValueError), pow, -1, -2, 3)
1309
+ else:
1310
+ self.assertEqual(pow(-1, -2, 3), 1)
1311
self.assertRaises(ValueError, pow, 1, 2, 0)
1312
1313
self.assertRaises(TypeError, pow)
tests/test_future/test_urllib2.py
@@ -691,10 +691,6 @@ def connect_ftp(self, user, passwd, host, port, dirs,
691
h = NullFTPHandler(data)
692
h.parent = MockOpener()
693
694
- # MIME guessing works in Python 3.8!
695
- guessed_mime = None
696
- if sys.hexversion >= 0x03080000:
697
- guessed_mime = "image/gif"
698
for url, host, port, user, passwd, type_, dirs, filename, mimetype in [
699
("ftp://localhost/foo/bar/baz.html",
700
"localhost", ftplib.FTP_PORT, "", "", "I",
@@ -713,7 +709,7 @@ def connect_ftp(self, user, passwd, host, port, dirs,
713
709
["foo", "bar"], "", None),
714
710
("ftp://localhost/baz.gif;type=a",
715
711
"localhost", ftplib.FTP_PORT, "", "", "A",
716
- [], "baz.gif", guessed_mime),
712
+ [], "baz.gif", None),
717
]:
718
req = Request(url)
719
req.timeout = None
tests/test_future/test_urllib_toplevel.py
@@ -781,8 +781,11 @@ def test_unquoting(self):
781
"%s" % result)
782
self.assertRaises((TypeError, AttributeError), urllib_parse.unquote, None)
783
self.assertRaises((TypeError, AttributeError), urllib_parse.unquote, ())
784
- with support.check_warnings(('', BytesWarning), quiet=True):
785
- self.assertRaises((TypeError, AttributeError), urllib_parse.unquote, bytes(b''))
+ if sys.version_info[:2] < (3, 9):
+ with support.check_warnings(('', BytesWarning), quiet=True):
786
+ self.assertRaises((TypeError, AttributeError), urllib_parse.unquote, bytes(b''))
787
788
+ self.assertEqual(urllib_parse.unquote(bytes(b"")), "")
789
790
def test_unquoting_badpercent(self):
791
# Test unquoting on bad percent-escapes
tests/test_future/test_utils.py
@@ -150,7 +150,7 @@ class Timeout(BaseException):
150
self.assertRaises(Timeout, raise_, Timeout())
151
152
153
- self.assertRaisesRegexp(
+ self.assertRaisesRegex(
154
TypeError, "class must derive from BaseException",
155
raise_, int)
156
0 commit comments