Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python.announce > #2880
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Dan Gass <dan.gass@gmail.com> |
| Newsgroups | comp.lang.python.announce |
| Subject | [baseline 0.2.1] Easy String Baseline |
| Date | Fri, 8 Jun 2018 00:02:23 -0500 |
| Lines | 89 |
| Approved | python-announce-list@python.org |
| Message-ID | <mailman.71.1528441918.22129.python-announce-list@python.org> (permalink) |
| References | <CAL2HjZUfr84RSFLH80VBjMhmd3xy8vUNBKhUrH9L7dRnP6UrUA@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| X-Trace | news.uni-berlin.de ovkeRZTF0gPQNpRMh8d3GQzlDc6epzlNpaETzr3ZqUmw== |
| Return-Path | <dan.gass@gmail.com> |
| X-Original-To | python-announce-list@python.org |
| Delivered-To | python-announce-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'url:pypi': 0.03; 'string.': 0.04; 'raises': 0.07; 'tool,': 0.07; 'url- ip:162.242.198.235/32': 0.07; 'url-ip:162.242.198/24': 0.07; 'url- ip:162.242/16': 0.07; 'url:py': 0.07; 'scripts': 0.08; '""")': 0.09; 'acceptance.': 0.09; 'failed,': 0.09; 'occurs.': 0.09; 'tests': 0.12; '->': 0.16; '0.2.1': 0.16; '``assert``': 0.16; 'code-block::': 0.16; 'equal.': 0.16; 'exited,': 0.16; 'jumps': 0.16; 'license:': 0.16; 'mismatch': 0.16; 'overwriting': 0.16; 'quoted': 0.16; 'subject:String': 0.16; 'them:': 0.16; 'update,': 0.16; 'url:project': 0.16; 'python': 0.16; 'string': 0.19; '"the': 0.21; 'dan': 0.21; 'skip:` 10': 0.21; 'shell': 0.21; 'changes,': 0.24; 'comparison': 0.25; 'mechanism': 0.25; 'url- ip:151.101.0.223/32': 0.25; 'url-ip:151.101.128.223/32': 0.25; 'url-ip:151.101.192.223/32': 0.25; 'url-ip:151.101.64.223/32': 0.25; 'url-ip:151.101.192/24': 0.26; 'announce': 0.27; 'url- ip:151.101.0/24': 0.27; 'url-ip:151.101.128/24': 0.27; 'url- ip:151.101.64/24': 0.27; 'import': 0.27; 'exception': 0.27; 'command': 0.28; 'message-id:@mail.gmail.com': 0.29; 'expected': 0.29; 'subject:] ': 0.30; 'output': 0.31; 'cancel': 0.31; 'url- ip:192.30/16': 0.31; 'url:io': 0.31; 'facilitate': 0.32; 'value.': 0.32; 'located': 0.32; 'source': 0.32; 'received:google.com': 0.33; 'url:readthedocs': 0.33; 'raise': 0.33; 'test': 0.33; 'run': 0.33; 'url-ip:151.101/16': 0.34; 'url-ip:151/8': 0.34; 'tool': 0.35; 'changed': 0.36; 'but': 0.36; 'url:en': 0.37; 'updated': 0.37; 'creation': 0.37; 'separate': 0.37; 'includes': 0.38; 'package.': 0.38; 'to:addr:python-announce-list': 0.38; 'url- ip:192.30.253.112/32': 0.38; 'url-ip:192.30.253.113/32': 0.38; 'url-ip:192.30.253/24': 0.38; 'url:github': 0.38; '"the': 0.38; 'skip:& 20': 0.38; 'file': 0.38; 'subject:[': 0.38; '...': 0.39; 'url:org': 0.40; 'being': 0.40; 'skip:b 20': 0.60; 'your': 0.60; 'back': 0.61; 'brown': 0.62; 'indented': 0.62; 'lazy': 0.62; 'triple': 0.62; 'skip:0 10': 0.62; 'simply': 0.62; 'easy': 0.62; 'to.': 0.63; 'directory': 0.63; 'review': 0.63; 'name': 0.65; 'offers': 0.65; 'maintenance': 0.66; 'for:': 0.66; '8bit%:100': 0.71; 'wish': 0.73; 'repeat': 0.74; 'url-ip:lookup error': 0.75; 'ending': 0.75; 'baseline': 0.84; 'subject:Easy': 0.84; 'dog.': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=Y7awUOwiaVHacRHVxE3ZPmBTHSWBAVEw+zaw1f7woVs=; b=OUB/2VzI8gHG9daC5OJfgo/kZeNZ5t+hTj7DAeHjqa6JRtHp2k+b+sX4bM36+R/UYd rrM2oLzWf0jFteeiEIPKCs8aKrT4HqUp0bf+3+0Honr1uptNInXfHcZU3h/LxAU4QhIq SHd97xEbGAU5NevvP6RYwRvl/JEdpsGgKnWhbkF6N/b3S3v3EIaZZ8vz+JCItOITQ+Kd XL7XamDs+W/849XbPD8xC0XyPypbMHOvz02QdMwPCrv0dx1k4fmSBoM8mhT1Z9s7Cz9b JiycIvNEAWGqpoO07IIcNA8baO3Rh24jM2myVoWFOUasPMgqew9ikbyIJQjfN0vPugjd 6nJA== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Y7awUOwiaVHacRHVxE3ZPmBTHSWBAVEw+zaw1f7woVs=; b=Amc0phYYsDVxJ2v2xuZy56soeiy42HsMYdOdLEZ4I5kEaBpnmzhSNfmFS/S3/IgWot wMZ/9m6TEKsCCpWOFRo4ltWTjv5iu7WcEBt+ltdEr86Hf6z9q6aSbqDS9QNEy79XH4YR f0Dv1Mk+TMp6tYzzqvEecb+Ohi6gf0AkIFCMRTogNafjDvGujyZGqGsHKlB5vWRv2AR1 +hbNuFys/L8l8DycZDd1AwmSbD7D9KLclJpmg3j73GWl1nxZcXml8KA2FUGN2OcnEDgX 9RgLWMRgPOKbht6aMlih1xlNslVS5yaXIQbOT6bJ+m3DOe6i1fW/hAwphFl6dvnReeF9 Ht0Q== |
| X-Gm-Message-State | APt69E120HoBFPWo0/k/AfccZ5mfrfcD1cmQkldhE2G8SXFVRjzdbOxZ sllDCMhPVLC8A+V5AWy+dFcqKuGdqcayLKlHm1lWCA== |
| X-Google-Smtp-Source | ADUXVKJ+rtDQxfVosrTs4ohsK8HNm/ZgLu3fpo+qM9Rq3+pOKUWMH9mkxFqpNO0BT8TDrw7lCcljE8vfr0ETigF1gV8= |
| X-Received | by 2002:aca:8d3:: with SMTP id 202-v6mr2584666oii.249.1528434144437; Thu, 07 Jun 2018 22:02:24 -0700 (PDT) |
| X-Mailman-Approved-At | Fri, 08 Jun 2018 03:11:56 -0400 |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.26 |
| X-BeenThere | python-announce-list@python.org |
| X-Mailman-Version | 2.1.26 |
| Precedence | list |
| List-Id | Announcement-only list for the Python programming language <python-announce-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-announce-list>, <mailto:python-announce-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-announce-list/> |
| List-Post | <mailto:python-announce-list@python.org> |
| List-Help | <mailto:python-announce-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-announce-list>, <mailto:python-announce-list-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <CAL2HjZUfr84RSFLH80VBjMhmd3xy8vUNBKhUrH9L7dRnP6UrUA@mail.gmail.com> |
| Xref | csiph.com comp.lang.python.announce:2880 |
Show key headers only | View raw
I am please to announce the availability of the "baseline" package.
This tool streamlines creation and maintenance of tests which compare string
output against a baseline. It offers a mechanism to compare a string against
a baselined copy and update the baselined copy to match the new value when a
mismatch occurs. The update process includes a manual step to facilitate a
review of the change before acceptance. The tool uses multi-line string
format
for string baselines to improve readability for human review.
Docs: https://baseline.readthedocs.io/en/latest/
PyPi: https://pypi.org/project/baseline/
Repo: https://github.com/dmgass/baseline
License: MIT
With Regards,
Dan Gass
(dan.gass at gmail)
***********
Quick Start
***********
Create an empty baseline with a triple quoted multi-line string. Place
the ending triple quote on a separate line and indent it to the level
you wish the string baseline update to be indented to. Add a compare of
the string being tested to the baseline string. Then save the file as
``fox.py``:
.. code-block:: python
from baseline import Baseline
expected = Baseline("""
""")
test_string = "THE QUICK BROWN FOX\n JUMPS\nOVER THE LAZY DOG."
assert test_string == expected
Run ``fox.py`` and observe that the ``assert`` raises an exception since
the strings are not equal. Because the comparison failed, the tool located
the triple quoted baseline string in the source file and updated it with the
miscompared value. When the interpretter exited, the tool saved the updated
source file but changed the file name to ``fox.update.py``:
.. code-block:: python
from baseline import Baseline
expected = Baseline("""
THE QUICK BROWN FOX
JUMPS
OVER THE LAZY DOG.
""")
test_string = "THE QUICK BROWN FOX\n JUMPS\nOVER THE LAZY DOG."
assert test_string == expected
After reviewing the change with your favorite file differencing tool,
accept the change by either manually overwriting the original file or use
the ``baseline`` command line tool to scan the directory for updated
scripts and accept them:
.. code-block:: shell
$ python -m baseline *
Found updates for:
fox.py
Hit [ENTER] to update, [Ctrl-C] to cancel
fox.update.py -> fox.py
Run ``fox.py`` again and observe the ``assert`` does not raise an exception
nor is a source file update generated. If in the future the test value
changes, the ``assert`` will raise an exception and cause a new source file
update to be generated. Simply repeat the review and acceptance step and you
are back in business!
<P><A HREF="https://baseline.readthedocs.io/en/latest/">
baseline 0.2.1</A> - Easy String Baseline (07-Jun-18)
Back to comp.lang.python.announce | Previous | Next | Find similar | Unroll thread
[baseline 0.2.1] Easy String Baseline Dan Gass <dan.gass@gmail.com> - 2018-06-08 00:02 -0500
csiph-web