Merge pull request #97 from a-feld/develop

Fix missing sys import for getcallargs backport.
This commit is contained in:
Graham Dumpleton 2017-03-15 10:32:33 +11:00 committed by GitHub
commit 01a29008ba
2 changed files with 8 additions and 0 deletions

View File

@ -4,6 +4,7 @@
# of the PSF license used for Python 2.7.
from inspect import getargspec, ismethod
import sys
def getcallargs(func, *positional, **named):
"""Get the mapping of arguments to values.

View File

@ -21,3 +21,10 @@ class TestArguments(unittest.TestCase):
calculated = wrapt.getcallargs(function, 10, 20, 30, 40, 50, 60)
self.assertEqual(expected, calculated)
def test_unexpected_unicode_keyword(self):
def function(a=2):
pass
kwargs = { u'b': 40 }
self.assertRaises(TypeError, wrapt.getcallargs, function, **kwargs)