On 10Oct2013 07:00, Gilles Lenfant <gilles.lenf...@gmail.com> wrote:
> (explaining the title) : my app has functions and methods (and
> maybe classes in the future) that are decorated by decorators
> provided by the standard library or 3rd party packages.
> 
> But I need to test "undecorated" functions and methods in my unit tests, 
> preferably without adding "special stuffs" in my target tested modules.
> 
> Can someone point out good practices or dedicated tools that "remove 
> temporarily" the decorations.
> I pasted a small example of what I heed at http://pastebin.com/20CmHQ7Y

Speaking for myself, I would be include to recast this code:

  @absolutize
  def addition(a, b):
      return a + b

into:

  def _addition(a, b):
      return a + b

  addition = absolutize(_addition)

Then you can unit test both _addition() and addition().

And so forth.

Cheers,
-- 
Cameron Simpson <c...@zip.com.au>

1st Law Economists: For every economist there exists an equal and opposite
                    economist.
2nd Law Economists: They're both always wrong!
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to