summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_module.py
diff options
context:
space:
mode:
authorEthan Furman <ethan@stoneleaf.us>2014-04-24 21:47:47 (GMT)
committerEthan Furman <ethan@stoneleaf.us>2014-04-24 21:47:47 (GMT)
commit7b9ff0e6da5371214b29053cdb96218e0d2eb655 (patch)
treeda11b0d718916d64a256d36fcc41287aca922e28 /Lib/test/test_module.py
parent7101cb07ef8cb9e63b99b0e1c8200f355841772c (diff)
downloadcpython-7b9ff0e6da5371214b29053cdb96218e0d2eb655.zip
cpython-7b9ff0e6da5371214b29053cdb96218e0d2eb655.tar.gz
cpython-7b9ff0e6da5371214b29053cdb96218e0d2eb655.tar.bz2
Issue8297: module attribute lookup failures now include module name in error message.
Diffstat (limited to 'Lib/test/test_module.py')
-rw-r--r--Lib/test/test_module.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_module.py b/Lib/test/test_module.py
index 1230293..5a22e69 100644
--- a/Lib/test/test_module.py
+++ b/Lib/test/test_module.py
@@ -30,6 +30,22 @@ class ModuleTests(unittest.TestCase):
pass
self.assertEqual(foo.__doc__, ModuleType.__doc__)
+ def test_unintialized_missing_getattr(self):
+ # Issue 8297
+ # test the text in the AttributeError of an uninitialized module
+ foo = ModuleType.__new__(ModuleType)
+ self.assertRaisesRegex(
+ AttributeError, "module has no attribute 'not_here'",
+ getattr, foo, "not_here")
+
+ def test_missing_getattr(self):
+ # Issue 8297
+ # test the text in the AttributeError
+ foo = ModuleType("foo")
+ self.assertRaisesRegex(
+ AttributeError, "module 'foo' has no attribute 'not_here'",
+ getattr, foo, "not_here")
+
def test_no_docstring(self):
# Regularly initialized module, no docstring
foo = ModuleType("foo")