Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.023 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'decorator': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; '~ethan~': 0.09; 'bug': 0.12; 'accepts': 0.16; 'behave': 0.16; 'camp': 0.16; 'inputs': 0.16; 'philosophy.': 0.16; 'received:70.85.130': 0.16; 'rides)': 0.16; 'roy': 0.16; 'simpson': 0.16; 'wrote:': 0.18; 'all,': 0.19; '>>>': 0.22; 'tests': 0.22; 'header:User-Agent:1': 0.23; "aren't": 0.24; 'test.': 0.24; 'certain': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'testing': 0.29; 'rest': 0.29; 'especially': 0.30; "i'm": 0.30; 'easier': 0.31; 'usually': 0.31; 'faster,': 0.31; 'lies': 0.31; 'piece': 0.31; 'know.': 0.32; 'stuff': 0.32; 'interface': 0.32; 'used,': 0.33; 'knowledge': 0.35; 'except': 0.35; 'test': 0.35; 'but': 0.35; 'there': 0.35; 'edge': 0.36; 'functions.': 0.36; 'sequence': 0.36; 'done': 0.36; 'charset:us- ascii': 0.36; 'should': 0.36; 'easily': 0.37; 'skip:o 20': 0.38; 'system,': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'that,': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'skip:u 10': 0.60; "you're": 0.61; 'complete': 0.62; 'more': 0.64; 'smith': 0.68; 'anyone.': 0.74; 'article': 0.77; 'batchelder': 0.84; 'guts': 0.84; 'seldom': 0.84; 'banner': 0.93; 'imagine': 0.93; 'lucky': 0.93 Date: Fri, 11 Oct 2013 10:46:38 -0700 From: Ethan Furman User-Agent: Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Skipping decorators in unit tests References: <52573BED.40305@nedbatchelder.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3304.hostgator.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stoneleaf.us X-BWhitelist: no X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([192.168.1.115]) [50.39.86.194]:40084 X-Source-Auth: ethan+stoneleaf.us X-Email-Count: 6 X-Source-Cap: dG9idWs7dG9idWs7Z2F0b3IzMzA0Lmhvc3RnYXRvci5jb20= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1381516410 news.xs4all.nl 16005 [2001:888:2000:d::a6]:52052 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:56699 On 10/10/2013 08:01 PM, Roy Smith wrote: > On 10Oct2013 19:44, Ned Batchelder wrote: >>> 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. > > In article , > Cameron Simpson wrote: >> If the undecorated function is buggy, the decorated function will >> be buggy. But the bug will be harder to resolve, and if you're >> especially lucky the decorator will often-but-not-always conceal >> the bug in the inner function. > > And there lies the fundamental white-box vs. black-box testing conundrum. > > The black-box camp (whose flag Ned is flying) says, "There is an exposed > interface which accepts certain inputs and promises certain outputs. > That's all you know, that's all you ever can know, and that's all you > should ever want to know. The interface is constant. The guts can > change without notice". That's a perfectly valid philosophy. > > The white-box camp (under which banner Cameron rides) says, "There's a > lot of neat stuff under the covers, and I can do a better, faster, and > more complete testing job if I take advantage of my knowledge of what's > under the kimono". That, too, is a valid philosophy. Some tests can also be done much more easily with white-box. Imagine an edge case which takes an exact that requires an exact, seldom used, sequence of events because an internal bug is usually counteracted by the rest of the system, except in some small number of cases. Directly testing the internal piece directly for the bug can be much easier than setting up the long and involved test. -- ~Ethan~