diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-10-16 23:24:44 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-10-16 23:24:44 (GMT) |
commit | fcf5d639f508b5a7ebf42d858390a6bd3bbb2c61 (patch) | |
tree | 193a1dd1d41e2403c61cd021409c28b843760cc6 /Lib/test/test_import.py | |
parent | d31fdc547b1805516f6013af672e43cc66bd8c22 (diff) | |
download | cpython-fcf5d639f508b5a7ebf42d858390a6bd3bbb2c61.zip cpython-fcf5d639f508b5a7ebf42d858390a6bd3bbb2c61.tar.gz cpython-fcf5d639f508b5a7ebf42d858390a6bd3bbb2c61.tar.bz2 |
forward port r66386
Diffstat (limited to 'Lib/test/test_import.py')
-rw-r--r-- | Lib/test/test_import.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py index 0dbbbf0..6598d4e 100644 --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -266,21 +266,24 @@ class RelativeImport(unittest.TestCase): self.assertTrue(hasattr(relimport, "RelativeImport")) def test_issue3221(self): + # Note for mergers: the 'absolute' tests from the 2.x branch + # are missing in Py3k because implicit relative imports are + # a thing of the past def check_relative(): exec("from . import relimport", ns) - # Check both OK with __package__ and __name__ correct + # Check relative import OK with __package__ and __name__ correct ns = dict(__package__='test', __name__='test.notarealmodule') check_relative() - # Check both OK with only __name__ wrong + # Check relative import OK with only __name__ wrong ns = dict(__package__='test', __name__='notarealpkg.notarealmodule') check_relative() - # Check relative fails with only __package__ wrong + # Check relative import fails with only __package__ wrong ns = dict(__package__='foo', __name__='test.notarealmodule') self.assertRaises(SystemError, check_relative) - # Check relative fails with __package__ and __name__ wrong + # Check relative import fails with __package__ and __name__ wrong ns = dict(__package__='foo', __name__='notarealpkg.notarealmodule') self.assertRaises(SystemError, check_relative) - # Check both fail with package set to a non-string + # Check relative import fails with package set to a non-string ns = dict(__package__=object()) self.assertRaises(ValueError, check_relative) |