diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-01-20 14:21:16 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-01-20 14:21:16 (GMT) |
commit | e18ef194d93afe9480ea7bd1da24d3636b81f2b3 (patch) | |
tree | 36597711edf34eaab5c4acac72b1b7d8834088a7 /Lib | |
parent | 196a0f7a8aa4c0b3482bcdf08473c9e593e41be0 (diff) | |
download | cpython-e18ef194d93afe9480ea7bd1da24d3636b81f2b3.zip cpython-e18ef194d93afe9480ea7bd1da24d3636b81f2b3.tar.gz cpython-e18ef194d93afe9480ea7bd1da24d3636b81f2b3.tar.bz2 |
allow unicode keyword arguments for the ** syntax #4978
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_extcall.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_extcall.py b/Lib/test/test_extcall.py index 8088fe2..f4ab204 100644 --- a/Lib/test/test_extcall.py +++ b/Lib/test/test_extcall.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """Doctest for method/function calls. We're going the use these types for extra testing @@ -252,11 +253,30 @@ TypeError if te dictionary is not empty """ +import unittest from test import test_support + +class UnicodeKeywordArgsTest(unittest.TestCase): + + def test_unicode_keywords(self): + def f(a): + return a + self.assertEqual(f(**{u'a': 4}), 4) + self.assertRaises(TypeError, f, **{u'stören': 4}) + self.assertRaises(TypeError, f, **{u'someLongString':2}) + try: + f(a=4, **{u'a': 4}) + except TypeError: + pass + else: + self.fail("duplicate arguments didn't raise") + + def test_main(): from test import test_extcall # self import test_support.run_doctest(test_extcall, True) + test_support.run_unittest(UnicodeKeywordArgsTest) if __name__ == '__main__': test_main() |