Merge pull request #97 from a-feld/develop
Fix missing sys import for getcallargs backport.
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
# of the PSF license used for Python 2.7.
|
# of the PSF license used for Python 2.7.
|
||||||
|
|
||||||
from inspect import getargspec, ismethod
|
from inspect import getargspec, ismethod
|
||||||
|
import sys
|
||||||
|
|
||||||
def getcallargs(func, *positional, **named):
|
def getcallargs(func, *positional, **named):
|
||||||
"""Get the mapping of arguments to values.
|
"""Get the mapping of arguments to values.
|
||||||
|
|||||||
@@ -21,3 +21,10 @@ class TestArguments(unittest.TestCase):
|
|||||||
calculated = wrapt.getcallargs(function, 10, 20, 30, 40, 50, 60)
|
calculated = wrapt.getcallargs(function, 10, 20, 30, 40, 50, 60)
|
||||||
|
|
||||||
self.assertEqual(expected, calculated)
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user