Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Vincent Davis Newsgroups: comp.lang.python Subject: manually build a unittest/doctest object. Date: Mon, 7 Dec 2015 20:30:19 -0700 Lines: 12 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de B8NNiFJzzGgmwVJURe7BoAytLlkhWc/II1mnN5Nv1S9A== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'doctest': 0.07; 'subject:build': 0.07; 'unittest': 0.07; 'attempted': 0.09; 'python': 0.10; '"hello': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:unittest': 0.16; 'string': 0.17; 'working.': 0.18; 'to:name:python-list@python.org': 0.20; 'code,': 0.23; 'example': 0.26; 'message-id:@mail.gmail.com': 0.27; 'subject:/': 0.30; 'skip:d 40': 0.32; 'skip:d 20': 0.34; 'skip:& 20': 0.35; 'received:google.com': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'skip:& 10': 0.37; 'thanks': 0.37; 'received:209': 0.38; 'test': 0.39; 'received:209.85.214': 0.39; 'build': 0.40; 'to:addr:python.org': 0.40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vincentdavis.net; s=google; h=mime-version:from:date:message-id:subject:to:content-type; bh=EGtLTOAUzmN0xBjIO/FmQ4BCbiJTHzuVoeklDlUj3j4=; b=uA/5JwomU7VT9B3fu5vbf0uLhN4rCkgFclgy5xn+rF8WBemHA4HeQ4i+dPVp5Bdcqm 7cTmuyUO+n6cOmdgaOxSuuvtJvdcTTj64g2vksnh6Zfy0Kr6gKV0FiQt2vROaK5DlExf 9Ath5mPU6xJGhlCmnc0ff1EW+iJHk+98DRiLw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-type; bh=EGtLTOAUzmN0xBjIO/FmQ4BCbiJTHzuVoeklDlUj3j4=; b=m5xiSi5VLUin+qt3ibYVdhpq3/ra0UeFQahnPJtaRGVowUCVh6sQdw2BNXJVVhGbOS axZX8sM9zyIZUeKPEZAVsdzHCybnae3dVk9KToocqwIQttU3DzH6UHBF6/N0U8O+RBYT GVA3jwXEeZisAUCwmdMxl090vOdTJmwtYd+noAVAqxNCqtwz5cEjBfLv1mpSYJlTiWFR xblMxIJStxviUlZAX58vm4ArxCbH55ql/XhRYXLvTUKZm1VS9cisBxpRh4+oJWpCPAJ/ rL2/0Q/UK4UwfqoPB1LhNvrVKY8o/97veFoG22WgSYrkU1rdfE/cRueaHjT76KEOKBwU qlqw== X-Gm-Message-State: ALoCoQn7aAovla1qyWMWN70ilcc1/r/tCxx0d+Wco32ldoq0RgeHuD8fXBt4jaWRgrgGPsm49uDg8oe5XDFN8QGtQE/Z+34TNh2PFCOZ8+DYfWeMTleXVIQ= X-Received: by 10.182.24.9 with SMTP id q9mr425120obf.73.1449545438918; Mon, 07 Dec 2015 19:30:38 -0800 (PST) X-Content-Filtered-By: Mailman/MimeDel 2.1.20+ 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:100132 If I have a string that is python code, for example mycode = "print('hello world')" myresult = "hello world" How can a "manually" build a unittest (doctest) and test I get myresult I have attempted to build a doctest but that is not working. e = doctest.Example(source="print('hello world')/n", want="hello world\n") t = doctest.DocTestRunner() t.run(e) Thanks Vincent Davis