Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Laura Creighton Newsgroups: comp.lang.python Subject: Re: manually build a unittest/doctest object. Date: Tue, 08 Dec 2015 15:30:39 +0100 Lines: 24 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de AlaYEJwgrGyAzo6KK8TXxwIOcqCsgGXzY6kZJ2w6s6JA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'url:pypi': 0.03; 'json': 0.05; 'that?': 0.05; 'doctest': 0.07; 'seemed': 0.07; 'subject:build': 0.07; 'cc:addr:python-list': 0.09; 'received:openend.se': 0.09; 'received:theraft.openend.se': 0.09; "'hello": 0.16; '2:06': 0.16; '>on': 0.16; 'cc:addr:lac': 0.16; 'cc:addr:openend.se': 0.16; 'from:addr:lac': 0.16; 'from:addr:openend.se': 0.16; 'from:name:laura creighton': 0.16; 'message-id:@fido.openend.se': 0.16; 'received:fido': 0.16; 'received:fido.openend.se': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:unittest': 0.16; 'wrote:': 0.16; 'laura': 0.18; 'stick': 0.18; 'test.': 0.18; '2015': 0.20; 'cc:addr:python.org': 0.20; 'cc:2**2': 0.20; 'cc:no real name:2**0': 0.22; 'am,': 0.23; 'dec': 0.23; 'this:': 0.23; 'tried': 0.24; '-0700,': 0.29; 'received:se': 0.29; 'subject:/': 0.30; 'url:mailman': 0.30; 'maybe': 0.33; 'source': 0.33; 'url:python': 0.33; 'url:listinfo': 0.34; 'tue,': 0.34; 'skip:> 10': 0.35; 'something': 0.35; 'but': 0.36; 'there': 0.36; 'url:org': 0.36; 'subject:: ': 0.37; 'why': 0.39; 'test': 0.39; 'skip:e 20': 0.39; 'url:mail': 0.40; 'header:Message-Id:1': 0.61; 'header:In-reply-to:1': 0.84; 'otten': 0.84; 'peter,': 0.84; 'notebook': 0.96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openend.se; s=default; t=1449585045; bh=S2HTxi1jKZTNY1K3QwZM7LG/6+TIO6I07EyQl+iHuCQ=; h=To:cc:From:Subject:In-reply-to:References:Date:From; b=eaKZqiVdsTuD9wlHesmEE9n6x3aAsOtWZv1NukLuvLxQtRz5iPKCZ4cCb4iz8ZiOx IvOYW4Bus+td/f/O5fdbbFp/fzTLkoHyr6NPffyVEA2mMMPb2Crbx+eM1JHl42/sNE 8gPQu3cv/z3+oTTxbLXYIzNsfdvKFPSO9kgb6jwc= In-reply-to: Comments: In-reply-to Vincent Davis message dated "Tue, 08 Dec 2015 07:04:39 -0700." Content-ID: <32412.1449585039.1@fido> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.9 (theraft.openend.se [82.96.5.2]); Tue, 08 Dec 2015 15:30:45 +0100 (CET) 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: , Xref: csiph.com comp.lang.python:100159 In a message of Tue, 08 Dec 2015 07:04:39 -0700, Vincent Davis writes: >On Tue, Dec 8, 2015 at 2:06 AM, Peter Otten <__peter__@web.de> wrote: > >> But why would you want to do that? > > >Thanks Peter, I want to do that because I want to test jupyter notebooks. >​The notebook is in JSON and I can get the source and result out but it was >unclear to me how to stick this into a test. doctest seemed the simplest >but maybe there is a better way. > >I also tried something like: >assert exec("""print('hello word')""") == 'hello word' > > >Vincent Davis >720-301-3003 >-- >https://mail.python.org/mailman/listinfo/python-list Check out this: https://pypi.python.org/pypi/pytest-ipynb Laura