Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin3!goblin2!goblin.stu.neva.ru!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'url:pypi': 0.03; 'argument': 0.05; 'skip:` 10': 0.07; 'subject:ANN': 0.07; 'subject:released': 0.07; '------------': 0.09; 'http': 0.09; 'resp': 0.09; 'added.': 0.16; 'headers,': 0.16; 'new-style': 0.16; 'on)': 0.16; 'subject:library': 0.16; 'url:packages': 0.16; 'wsgi': 0.16; 'sender:addr:gmail.com': 0.17; 'library': 0.18; 'subject:] ': 0.20; '8bit%:5': 0.22; 'import': 0.22; 'convenient': 0.24; 'skip:` 20': 0.24; '(or': 0.24; '>': 0.26; 'testing': 0.29; 'skip:p 30': 0.29; '8bit%:3': 0.30; 'returned': 0.30; 'skip:( 40': 0.30; 'message-id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; 'values.': 0.31; 'class': 0.32; 'url:python': 0.33; 'test': 0.35; 'received:google.com': 0.35; 'version': 0.36; 'url:org': 0.36; 'application': 0.37; 'subject:new': 0.38; 'skip:& 10': 0.38; 'to:addr:python-list': 0.38; 'skip:- 10': 0.38; 'skip:& 20': 0.39; 'subject:[': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'users': 0.40; '8bit%:6': 0.40; 'skip:a 30': 0.61; 'new': 0.61; 'details.': 0.61; "'foo'": 0.84; '(s)': 0.84; 'type=int,': 0.84; 'validator': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=omyblqdZTat0S3dqxRew0k1QhGYelas6NIEsM0SlyJw=; b=btxWUjp9YD3zr+Y1lduZRgdFVj/ouDYRNYQcq/EVzFu80uK3tz/+URY0fo7miwbdZ0 Uhtu7W8/+YJUdh3eiB89HgnmsFUy7Z60CA0g9v0UHjZq8dr3GunCOEAnmrdCfQM0Mygx QTR5YavWrn6RGC8fV7B83hvCrET3zIfAoIDBNBAF/UPZbB0BKVP3Lsyew+DsDdXnDLwu UnXLfvd8m+cQZtWRsojTCwE/MhFQFjouHQ+qIznz/l1neeAz28HzONLRLtQESiBdJMqW wr9Ah+wG3iLmEUphSI9y4CdJTWB8AhMemB/INnDv4btZ+yXDeJrxMLRk0d2UmC9UIhvd o5CA== MIME-Version: 1.0 X-Received: by 10.229.84.198 with SMTP id k6mr3647347qcl.20.1394461427054; Mon, 10 Mar 2014 07:23:47 -0700 (PDT) Sender: kwatch@gmail.com Date: Mon, 10 Mar 2014 23:23:46 +0900 X-Google-Sender-Auth: LW-Awt0ClCwO8r8CDiYCcusg-HI Subject: [ANN] Oktest.py 0.14.0 released - a new-style testing library From: Makoto Kuwata To: python-list@python.org Content-Type: multipart/alternative; boundary=001a1134541a033cfb04f4415acc 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: 142 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1394461436 news.xs4all.nl 2831 [2001:888:2000:d::a6]:53462 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68145 --001a1134541a033cfb04f4415acc Content-Type: text/plain; charset=ISO-8859-1 I released Oktest.py 0.14.0. http://pypi.python.org/pypi/Oktest/ http://packages.python.org/Oktest/ Oktest.py is a new-style testing library for Python:: from oktest import ok, NG ok (x) > 0 # same as assertTrue(x > 0) ok (s) == 'foo' # same as assertEqual(s, 'foo') ok (s) != 'foo' # same as assertNotEqual(s, 'foo') ok (f).raises(ValueError) # same as assertRaises(ValueError, f) ok (u'foo').is_a(unicode) # same as assertTrue(isinstance(u'foo', unicode)) ok ('A.txt').is_file() # same as assertTrue(os.path.isfile('A.txt')) It supports WSGI Application testing:: from oktest.web import WSGITest http = WSGITest(app) resp = http.GET('/') ok (resp).is_response(200).json({"status": "OK"}) See http://packages.python.org/Oktest/ for details. New features ------------ * [enhance] Response object returned by `WSGITest#GET()' or '#POST()' now supports `body_json' property. Example:: from oktest.web import WSGITest http = WSGITest(app) resp = http.GET('/') print(resp.body_json) * [change] `headers` argument of `WSGITest#GET()' (or '#POST()' and so on) now means HTTP headers, not environ values. Example:: ## version <= 0.13 http.GET('/', headers={'HTTP_COOKIE': 'name=val'}) ## version >= 0.14 http.GET('/', headers={'Cookie': 'name=val'}) ## or http.GET('/', environ={'HTTP_COOKIE': 'name=val'}) * [enhance] (Experimental) `oktest.validator.Validator' class is added. It is convenient to test complex data structure. Example:: from oktest.validator import Validator as V ok (resp.body_json) == { "status": "OK", "member": { "name": "Haruhi", "gender": V('gender', enum=('F', 'M')), "age": V('age', type=int, between=(15, 18)), "birthday": V('created_at', pattern=r'^\d\d\d\d-\d\d-\d\d$') } } See users guide for details. http://www.kuwata-lab.com/oktest/oktest-py_users-guide.html#validator -- regars, makoto kuwata --001a1134541a033cfb04f4415acc Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I released Oktest.py 0.14.0.
http://pypi.python.org/pypi/Oktest/

Oktest.py is a new-style testing library for Python::

=A0 =A0 from oktest import ok, NG
=A0 =A0= ok (x) > 0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 # same as assertTrue(x > = 0)
=A0 =A0 ok (s) =3D=3D 'foo' =A0 =A0 =A0 =A0 =A0 =A0# s= ame as assertEqual(s, 'foo')
=A0 =A0 ok (s) !=3D 'foo' =A0 =A0 =A0 =A0 =A0 =A0# same as ass= ertNotEqual(s, 'foo')
=A0 =A0 ok (f).raises(ValueError) = =A0# same as assertRaises(ValueError, f)
=A0 =A0 ok (u'foo= 9;).is_a(unicode) =A0# same as assertTrue(isinstance(u'foo', unicod= e))
=A0 =A0 ok ('A.txt').is_file() =A0 =A0 # same as assertTrue(os= .path.isfile('A.txt'))

It supports WSGI Ap= plication testing::

=A0 =A0 from oktest.web import= WSGITest
=A0 =A0 http =3D WSGITest(app)
=A0 =A0 resp =3D http.GET(= 9;/')
=A0 =A0 ok (resp).is_response(200).json({"status&q= uot;: "OK"})

See
for details.


New features
------------

* [enhance] Response object ret= urned by `WSGITest#GET()' or '#POST()' now
=A0 suppor= ts `body_json' property.
=A0 Example::

=A0 =A0 =A0 from oktest.web imp= ort WSGITest
=A0 =A0 =A0 http =3D WSGITest(app)
=A0 =A0= =A0 resp =3D http.GET('/')
=A0 =A0 =A0 print(resp.body_j= son)

* [change] `headers` argument of `WSGITest#GET()' (or '#POST()'= and so on)
=A0 now means HTTP headers, not environ values.
=
=A0 Example::

=A0 =A0 =A0 ## version <=3D = 0.13
=A0 =A0 =A0 http.GET('/', headers=3D{'HTTP_COOKIE': &#= 39;name=3Dval'})

=A0 =A0 =A0 ## version >= =3D 0.14
=A0 =A0 =A0 http.GET('/', headers=3D{'Cookie= ': 'name=3Dval'})
=A0 =A0 =A0 ## or
=A0 =A0 =A0 http.GET('/', environ= =3D{'HTTP_COOKIE': 'name=3Dval'})

= * [enhance] (Experimental) `oktest.validator.Validator' class is added.=
=A0 It is convenient to test complex data structure.
=A0 Example::

=A0 =A0 =A0 from oktest.validat= or import Validator as V
=A0 =A0 =A0 ok (resp.body_json) =3D=3D {=
=A0 =A0 =A0 =A0 "status": "OK",
= =A0 =A0 =A0 =A0 "member": {
=A0 =A0 =A0 =A0 =A0 "name": =A0 =A0 "Haruhi",
=A0 =A0 =A0 =A0 =A0 "gender": =A0 V('gender', enum= =3D('F', 'M')),
=A0 =A0 =A0 =A0 =A0 "age&quo= t;: =A0 =A0 =A0V('age', type=3Dint, between=3D(15, 18)),
=A0 =A0 =A0 =A0 =A0 "birthday": V('created_at', patt= ern=3Dr'^\d\d\d\d-\d\d-\d\d$')
=A0 =A0 =A0 =A0 }
=A0 =A0 =A0 }

--001a1134541a033cfb04f4415acc--