Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #56617
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <nedbat@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'preferably': 0.05; 'tests,': 0.09; 'cc:addr:python-list': 0.11; 'def': 0.12; 'b):': 0.16; 'behave': 0.16; 'forth.': 0.16; 'gilles': 0.16; 'heed': 0.16; 'modules.': 0.16; 'simpson': 0.16; 'do,': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'library': 0.18; 'all,': 0.19; 'app': 0.19; 'packages.': 0.19; 'solution.': 0.20; 'example': 0.22; 'cc:addr:python.org': 0.22; 'header:User- Agent:1': 0.23; "aren't": 0.24; 'decorators': 0.24; 'cheers,': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'code:': 0.26; 'header:In-Reply-To:1': 0.27; 'point': 0.28; "i'm": 0.30; '"remove': 0.31; 'maybe': 0.34; 'classes': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'functions.': 0.36; "i'll": 0.36; 'unit': 0.37; 'pm,': 0.38; 'how': 0.40; 'skip:u 10': 0.60; 'information,': 0.61; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'anyone.': 0.74; 'imagination': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=7tRTOS1kMxkV/EVWoUAOtrT+MvKB5s8dmgM/PxYhUSo=; b=MY3HRo1tL3DuXsHw8M2k7D841+7CS7wTbNyleaYIMpS4yuwnlisHRUJook1yUqQWCD P9fgjcLxrFsZpospNb/1t3fjI0pxXybtGAfwojzXH8xw6heXyd0Kz5wdzS5OyTYjwDHc CKvJ8D+parO+5pYeFf9hvbO0B9XhKULgsdqL9pXFyDhFflZckHMoEGzq6eI6yt4gv3Zw Z2VyyDcXr2lGtumc62yLLdk8cGdbftpxDNPwTC3dzobR9Jn6ZOM68sYbdgVFRJEZGuQL VAh75l6lnwWBjIaYtmO8/lQFAEv92fJBGFN70IJx7lEi96qwT1ph6qF6vxxpbWsE6Q0k BEAA== |
| X-Received | by 10.224.166.67 with SMTP id l3mr70753qay.39.1381448686439; Thu, 10 Oct 2013 16:44:46 -0700 (PDT) |
| Sender | Ned Batchelder <nedbat@gmail.com> |
| Date | Thu, 10 Oct 2013 19:44:45 -0400 |
| From | Ned Batchelder <ned@nedbatchelder.com> |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 |
| MIME-Version | 1.0 |
| To | gilles.lenfant@gmail.com |
| Subject | Re: Skipping decorators in unit tests |
| References | <2490050c-61d9-4bfd-bdd5-921e2f95a44b@googlegroups.com> <20131010221238.GA27082@cskk.homeip.net> |
| In-Reply-To | <20131010221238.GA27082@cskk.homeip.net> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.966.1381448694.18130.python-list@python.org> (permalink) |
| Lines | 41 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1381448694 news.xs4all.nl 15972 [2001:888:2000:d::a6]:55499 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:56617 |
Show key headers only | View raw
On 10/10/13 6:12 PM, Cameron Simpson wrote: > On 10Oct2013 07:00, Gilles Lenfant <gilles.lenfant@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, I have to admit I'm having a hard time understanding why you'd need to test the undecorated functions. After all, the undecorated functions aren't available to anyone. All that matters is how they behave with the decorators. But my imagination is weak: do you mind explaining more about what the functions do, what the decorators do, and why you need to test the undecorated functions? I'll learn something, and with more information, we might be able to find a better solution. --Ned.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Skipping decorators in unit tests Gilles Lenfant <gilles.lenfant@gmail.com> - 2013-10-10 07:00 -0700
Re: Skipping decorators in unit tests Cameron Simpson <cs@zip.com.au> - 2013-10-11 09:12 +1100
Re: Skipping decorators in unit tests Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-10-11 02:55 +0000
Re: Skipping decorators in unit tests Cameron Simpson <cs@zip.com.au> - 2013-10-11 14:13 +1100
Re: Skipping decorators in unit tests Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-10-11 04:36 +0000
Re: Skipping decorators in unit tests Terry Reedy <tjreedy@udel.edu> - 2013-10-11 04:23 -0400
Re: Skipping decorators in unit tests Ben Finney <ben+python@benfinney.id.au> - 2013-10-11 14:42 +1100
Re: Skipping decorators in unit tests Terry Reedy <tjreedy@udel.edu> - 2013-10-11 04:17 -0400
Re: Skipping decorators in unit tests Terry Reedy <tjreedy@udel.edu> - 2013-10-11 04:25 -0400
Re: Skipping decorators in unit tests Terry Reedy <tjreedy@udel.edu> - 2013-10-11 04:32 -0400
Re: Skipping decorators in unit tests Ethan Furman <ethan@stoneleaf.us> - 2013-10-11 10:51 -0700
Re: Skipping decorators in unit tests Ned Batchelder <ned@nedbatchelder.com> - 2013-10-10 19:44 -0400
Re: Skipping decorators in unit tests Terry Reedy <tjreedy@udel.edu> - 2013-10-10 21:12 -0400
Re: Skipping decorators in unit tests Gilles Lenfant <gilles.lenfant@gmail.com> - 2013-10-11 02:37 -0700
Re: Skipping decorators in unit tests Cameron Simpson <cs@zip.com.au> - 2013-10-12 08:38 +1100
csiph-web