Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'language.': 0.14; 'question.': 0.14; 'itself,': 0.16; 'measured': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'with?': 0.16; 'java,': 0.16; 'language': 0.16; 'wrote:': 0.18; 'module': 0.19; 'split': 0.19; 'code,': 0.22; 'comfortable': 0.22; 'putting': 0.22; 'separate': 0.22; 'header:User-Agent:1': 0.23; 'fairly': 0.24; 'java': 0.24; 'file.': 0.24; 'first,': 0.26; 'gets': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply- To:1': 0.27; 'testing': 0.29; 'bigger': 0.30; "i'm": 0.30; 'code': 0.31; 'lines': 0.31; 'probably': 0.32; 'another': 0.32; 'running': 0.33; "i'd": 0.34; 'classes': 0.35; 'something': 0.35; 'hundreds': 0.35; 'test': 0.35; 'but': 0.35; 'acceptable': 0.36; 'thanks': 0.36; 'should': 0.36; 'implement': 0.38; 'to:addr:python-list': 0.38; 'anything': 0.39; 'quote': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'received:org': 0.40; 'read': 0.60; 'most': 0.60; 'our': 0.64; 'different': 0.65; 'containing': 0.69; 'subject:this': 0.83; 'subject:good': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Is this a good way to implement testing Date: Sun, 03 May 2015 09:38:22 +0100 References: <878ud6mx4y.fsf@Equus.decebal.nl> <87383em7sn.fsf@Equus.decebal.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: host-78-147-17-139.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 In-Reply-To: <87383em7sn.fsf@Equus.decebal.nl> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1430642317 news.xs4all.nl 2848 [2001:888:2000:d::a6]:52130 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:89835 On 03/05/2015 08:36, Cecil Westerhof wrote: > > Thanks for the tips. For most I have to read a ‘little’ first, so I > will not implement them immediately. > Another question. Is it acceptable to have it in the module itself, or > should I put it in something like test_.py? The code for > testing is bigger as the code for the implementation, so I am leaning > to putting it in a separate file. > I'd go for the former if your implementation code base is measured in hundreds of lines of code, anything larger and I'd probably split the test code out. That's just my own rule of thumb, I'm sure others will quote different figures, but what it ultimately gets down to is what are you comfortable with? I ask because you should keep in mind that Python modules containing several classes and running into thousands of lines of code are fairly common. Python is not Java, and Java isn't Python either :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence