|
2 | 2 | Tests for the future.standard_library module |
3 | 3 | """ |
4 | 4 |
|
5 | | -from __future__ import absolute_import, unicode_literals, print_function |
| 5 | +from __future__ import absolute_import, print_function |
6 | 6 | from future import standard_library |
7 | 7 | from future import utils |
8 | 8 | from future.tests.base import unittest, CodeHandler, expectedFailurePY2 |
@@ -64,23 +64,23 @@ def test_is_py2_stdlib_module(self): |
64 | 64 | not any ([standard_library.is_py2_stdlib_module(module) |
65 | 65 | for module in py2modules])) |
66 | 66 |
|
67 | | - @unittest.skipIf(utils.PY3, 'generic import tests are for Py2 only') |
68 | | - def test_all(self): |
69 | | - """ |
70 | | - Tests whether all of the old imports in RENAMES are accessible |
71 | | - under their new names. |
72 | | - """ |
73 | | - for (oldname, newname) in standard_library.RENAMES.items(): |
74 | | - if newname == 'winreg' and sys.platform not in ['win32', 'win64']: |
75 | | - continue |
76 | | - if newname in standard_library.REPLACED_MODULES: |
77 | | - # Skip this check for e.g. the stdlib's ``test`` module, |
78 | | - # which we have replaced completely. |
79 | | - continue |
80 | | - oldmod = __import__(oldname) |
81 | | - newmod = __import__(newname) |
82 | | - if '.' not in oldname: |
83 | | - self.assertEqual(oldmod, newmod) |
| 67 | + # @unittest.skip("No longer relevant") |
| 68 | + # def test_all_modules_identical(self): |
| 69 | + # """ |
| 70 | + # Tests whether all of the old imports in RENAMES are accessible |
| 71 | + # under their new names. |
| 72 | + # """ |
| 73 | + # for (oldname, newname) in standard_library.RENAMES.items(): |
| 74 | + # if newname == 'winreg' and sys.platform not in ['win32', 'win64']: |
| 75 | + # continue |
| 76 | + # if newname in standard_library.REPLACED_MODULES: |
| 77 | + # # Skip this check for e.g. the stdlib's ``test`` module, |
| 78 | + # # which we have replaced completely. |
| 79 | + # continue |
| 80 | + # oldmod = __import__(oldname) |
| 81 | + # newmod = __import__(newname) |
| 82 | + # if '.' not in oldname: |
| 83 | + # self.assertEqual(oldmod, newmod) |
84 | 84 |
|
85 | 85 | @unittest.expectedFailure |
86 | 86 | def test_suspend_hooks(self): |
@@ -285,7 +285,7 @@ def test_profile(self): |
285 | 285 |
|
286 | 286 | def test_stringio(self): |
287 | 287 | from io import StringIO |
288 | | - s = StringIO('test') |
| 288 | + s = StringIO(u'test') |
289 | 289 | for method in ['tell', 'read', 'seek', 'close', 'flush']: |
290 | 290 | self.assertTrue(hasattr(s, method)) |
291 | 291 |
|
@@ -427,9 +427,32 @@ def test_install_aliases(self): |
427 | 427 | """ |
428 | 428 | from future.standard_library import remove_hooks, install_aliases |
429 | 429 | remove_hooks() |
430 | | - self.assertTrue('urllib.request' not in sys.modules) |
431 | 430 | install_aliases() |
| 431 | + |
| 432 | + from collections import Counter, OrderedDict # backported to Py2.6 |
| 433 | + from collections import UserDict, UserList, UserString |
| 434 | + |
| 435 | + # Requires Python dbm support: |
| 436 | + # import dbm |
| 437 | + # import dbm.dumb |
| 438 | + # import dbm.gnu |
| 439 | + # import dbm.ndbm |
| 440 | + |
| 441 | + from itertools import filterfalse, zip_longest |
| 442 | + |
| 443 | + from subprocess import check_output # backported to Py2.6 |
| 444 | + from subprocess import getoutput, getstatusoutput |
| 445 | + |
| 446 | + from sys import intern |
| 447 | + |
| 448 | + import test.support |
| 449 | + |
| 450 | + import urllib.error |
| 451 | + import urllib.parse |
432 | 452 | import urllib.request |
| 453 | + import urllib.response |
| 454 | + import urllib.robotparser |
| 455 | + |
433 | 456 | self.assertTrue('urlopen' in dir(urllib.request)) |
434 | 457 |
|
435 | 458 |
|
|
0 commit comments