thp/python-decontractors — pull request #1 by stefankoegl (2012-11-20 10:11:03+00:00)
Title: make keyword args available in Decontractor

When arguments for non-optional parameters are passed as keyword-args, they are not available in the decontractors. Example based on examples/simple.py:

````python
>>> from decontractors import *
>>>
>>> @Precondition(lambda: x > 0 and y > 0)
... @Postcondition(lambda: __return__ == (x + y))
... def positive_nonzero_addition(x, y):
... return x + y
...
>>>
>>> print positive_nonzero_addition(4, y=1) # keyword-arg here!
Traceback (most recent call last):
File "", line 1, in
File "decontractors.py", line 91, in wrapper
self.check_before(before)
File "decontractors.py", line 105, in check_before
result = eval(self.check.__code__, before.copy())
File "", line 1, in
NameError: global name 'y' is not defined
````