diff options
author | Georg Brandl <georg@python.org> | 2007-03-13 20:46:32 +0000 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2007-03-13 20:46:32 +0000 |
commit | 5240d7416c739e22298463cb08ba8aad7c762a4a (patch) | |
tree | 19d10f5e864c314c645a9020616626ef54ce638f /Lib/test/test_builtin.py | |
parent | 5dc4fe09b7648f9801558e766b21a3d3b2dcad3b (diff) | |
download | cpython-git-5240d7416c739e22298463cb08ba8aad7c762a4a.tar.gz |
Patch #1444529: the builtin compile() now accepts keyword arguments.
(backport)
Diffstat (limited to 'Lib/test/test_builtin.py')
-rw-r--r-- | Lib/test/test_builtin.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index 333e01e706..52178c8b64 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -107,9 +107,12 @@ class BuiltinTest(unittest.TestCase): __import__('sys') __import__('time') __import__('string') + __import__(name='sys') + __import__(name='time', level=0) self.assertRaises(ImportError, __import__, 'spamspam') self.assertRaises(TypeError, __import__, 1, 2, 3, 4) self.assertRaises(ValueError, __import__, '') + self.assertRaises(TypeError, __import__, 'sys', name='sys') def test_abs(self): # int @@ -243,15 +246,21 @@ class BuiltinTest(unittest.TestCase): compile('print 1\n', '', 'exec') bom = '\xef\xbb\xbf' compile(bom + 'print 1\n', '', 'exec') + compile(source='pass', filename='?', mode='exec') + compile(dont_inherit=0, filename='tmp', source='0', mode='eval') + compile('pass', '?', dont_inherit=1, mode='exec') self.assertRaises(TypeError, compile) self.assertRaises(ValueError, compile, 'print 42\n', '<string>', 'badmode') self.assertRaises(ValueError, compile, 'print 42\n', '<string>', 'single', 0xff) self.assertRaises(TypeError, compile, chr(0), 'f', 'exec') + self.assertRaises(TypeError, compile, 'pass', '?', 'exec', + mode='eval', source='0', filename='tmp') if have_unicode: compile(unicode('print u"\xc3\xa5"\n', 'utf8'), '', 'exec') self.assertRaises(TypeError, compile, unichr(0), 'f', 'exec') self.assertRaises(ValueError, compile, unicode('a = 1'), 'f', 'bad') + def test_delattr(self): import sys sys.spam = 1 |