Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python.announce > #3353

[baseline 1.0.0] Easy String Baseline

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 1.0.0] Easy String Baseline
Date Sun, 29 Mar 2020 23:45:10 -0500
Lines 117
Approved python-announce-list@python.org
Message-ID <158557052983.25192.python-announce-list@python.org> (permalink)
References <CAL2HjZUfr84RSFLH80VBjMhmd3xy8vUNBKhUrH9L7dRnP6UrUA@mail.gmail.com>
Reply-To python-list@python.org
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
X-Trace news.uni-berlin.de vEtpcmiZh6qEebuWds6SuAG8GeA/L2+ZPT7Ixy6vHpPg==
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'values': 0.03; 'interpreter': 0.04; 'string': 0.04; 'scripts': 0.05; '(python': 0.07; '3.8': 0.07; 'package.': 0.07; 'tests': 0.07; 'empty': 0.09; 'incompatible': 0.09; 'tested': 0.09; 'url-ip:151.101.0.223/32': 0.09; 'url-ip:151.101.128.223/32': 0.09; 'url- ip:151.101.192.223/32': 0.09; 'url-ip:151.101.64.223/32': 0.09; 'url:py': 0.09; 'values.': 0.09; 'url:github': 0.13; 'python': 0.13; 'behavior': 0.15; 'output': 0.15; '-&gt;': 0.16; '3.8,': 0.16; '3.8.': 0.16; 'behavior.': 0.16; 'changes,': 0.16; 'comparison': 0.16; 'dan': 0.16; 'deprecate': 0.16; 'facilitate': 0.16; 'failed,': 0.16; 'fox': 0.16; 'frames': 0.16; 'generated.': 0.16; 'lazy': 0.16; 'license:': 0.16; 'readability': 0.16; 'received:mail-vs1-xe32.google.com': 0.16; 'skip:` 10': 0.16; 'url-ip:104.208.221.96/32': 0.16; 'url-ip:104.208.221/24': 0.16; 'url-ip:104.208/16': 0.16; 'url-ip:192.30/16': 0.16; 'url:latest': 0.16; 'url:project': 0.16; 'url:pypi': 0.16; 'url:readthedocs': 0.16; 'announce': 0.17; 'import': 0.18; 'subject:] ': 0.22; 'command': 0.23; 'creation': 0.26; 'exception': 0.26; 'raw': 0.26; 'run': 0.27; 'source': 0.29; 'using': 0.30; 'cancel': 0.30; 'to.': 0.30; 'alternative': 0.31; 'ending': 0.31; 'mechanism': 0.31; '\xc2\xa0\xc2\xa0\xc2\xa0': 0.31; 'nor': 0.32; 'url:io': 0.32; 'message-id:@mail.gmail.com': 0.32; 'but': 0.33; 'change': 0.33; 'use': 0.34; 'received:google.com': 0.34; 'stack': 0.34; 'changes': 0.34; 'uses': 0.34; 'subject:[': 0.35; 'cause': 0.36; 'test': 0.37; 'from:addr:gmail.com': 0.37; 'header:In-Reply-To:1': 0.37; 'changed': 0.39; 'raise': 0.39; 'does': 0.39; 'support': 0.40; 'availability': 0.40; 'headers': 0.40; 'reviewing': 0.40; 'shell': 0.40; 'skip:\xc2 20': 0.40; 'to:addr:python-announce- list': 0.40; 'tool,': 0.40; 'generate': 0.60; 'found': 0.61; 'between': 0.61; 'skip:& 20': 0.61; 'includes': 0.62; 'back': 0.62; 'future': 0.62; 'updated': 0.63; 'above': 0.63; 'copy': 0.63; 'save': 0.63; 'skip:\xc2 10': 0.63; 'url-ip:192/8': 0.63; 'repeat': 0.64; 'against': 0.64; 'your': 0.64; 'skip:b 20': 0.67; 'quick': 0.67; '8bit%:82': 0.68; 'manually': 0.68; 'wish': 0.69; 'brown': 0.70; 'for:': 0.70; 'accept': 0.71; 'url-ip:lookup error': 0.74; 'maintenance': 0.74; 'updating': 0.76; 'compared': 0.80; '8bit%:100': 0.81; 'quote': 0.83; 'backwards': 0.84; 'baseline': 0.84; 'business!': 0.84; 'mismatch': 0.84; 'readability.': 0.84; 'revision': 0.84; 'update,': 0.84; 'url:update': 0.84; 'value.': 0.84; '\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0': 0.84; 'incorporates': 0.91; 'observe': 0.91; 'review.': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=dqRO5sTmhm4CpqEgSz3zUS0perOVlYueueLad8dXino=; b=hYGgcbfAEdkbHZreSSBichpXZFF4an38i5PmkPSeozzNEmngOY8c6wlYfkwruRn0rC r8Lh5Q6iTdjEf1JkO4ctiu2gTcivhPusZMrmuGwgcubbU9z7+B2xrETjpPzU41PG3K0E 3SCiBBr1UrPKp4EuWPNLYKHcbx73+RUxy+Q9IIzxs5yC/Q2WjJtSqiIgOYzR2gExxxHd CDsMa5eUfcGHFkKyMkdlDj9wOzEng5UyMCz+qT6v4V0aUVMxbfrLgK5ly2QmN62P6c7N YOjRA88e/+MVtXIMxst3EOuCz561YJnSDJwYazVs02UbI7lNn0UfqCwjp0YkTzfZAxM4 Mr1Q==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=dqRO5sTmhm4CpqEgSz3zUS0perOVlYueueLad8dXino=; b=J52P1sotOlZfTUvMyLiCET5eHEp+Vl4gHkevQS+WHi3bivG/npJajAfLYNmSGHIMCV YOZGlgcDDu3D7M44tbSCrr1wQljwww9iCsohr/p/xWKyrl26GO7K4xAuleQLwjnTPcRT gSRK6Ryiiqv7PNCRRgAFvaLwp0/6JkIl9B1pykxJhrpwaE0HEq2D9n3BQCI9BRoxeg/w 6Bds3RHmZuayPPxo048+m+C3jGRrFBd3HgRmvoRrwZoQH2E5f/ciCrgphLBURHxn8oxS gw+GLS5nYOH8xK6ATyExpDS8H00nEC5y1OQi/u428YhFQnnx0JfG+YVUWbVxVGNTCI0o KK+Q==
X-Gm-Message-State AGi0Puaqi/I1JjlMjA1qthqYDkrjttlKKq/d3C972BFJg0LnK/q8uAW8 x6GO6tO6YTpZI6wwRJ+hpFSLflAC78ckFI1IOC1+AuJC7n8=
X-Google-Smtp-Source APiQypISm44WO3TOPMpINSh0L984Mbd/Xll/M4+mT7OyjJDtkhROh+3ZPl9z8MxVMNosk9kx55rs32wZO0HHhleqyG0=
X-Received by 2002:a67:87cd:: with SMTP id j196mr6129002vsd.98.1585543521576; Sun, 29 Mar 2020 21:45:21 -0700 (PDT)
In-Reply-To <CAL2HjZUfr84RSFLH80VBjMhmd3xy8vUNBKhUrH9L7dRnP6UrUA@mail.gmail.com>
X-MailFrom dan.gass@gmail.com
X-Mailman-Rule-Hits emergency
X-Mailman-Rule-Misses dmarc-mitigation; no-senders; approved
Message-ID-Hash FOO7O2YDS66WCJMTAPRS2YLXAJSQ4UN5
X-Message-ID-Hash FOO7O2YDS66WCJMTAPRS2YLXAJSQ4UN5
X-Mailman-Approved-At Mon, 30 Mar 2020 08:15:20 -0400
X-Content-Filtered-By Mailman/MimeDel 3.3.1
X-Mailman-Version 3.3.1
Precedence list
List-Id Announcement-only list for the Python programming language <python-announce-list.python.org>
Archived-At <https://mail.python.org/archives/list/python-announce-list@python.org/message/FOO7O2YDS66WCJMTAPRS2YLXAJSQ4UN5/>
List-Archive <https://mail.python.org/archives/list/python-announce-list@python.org/>
List-Help <mailto:python-announce-list-request@python.org?subject=help>
List-Post <mailto:python-announce-list@python.org>
List-Subscribe <mailto:python-announce-list-join@python.org>
List-Unsubscribe <mailto:python-announce-list-leave@python.org>
Xref csiph.com comp.lang.python.announce:3353

Show key headers only | View raw


I am please to announce the availability of the first major release 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)

***********
Changes
***********

The following summarizes changes since the previous "beta" release (the
major revision bump signifies backwards incompatible changes):

+ Improve baseline update when multiple values compared against the
  same baseline. Generate a single multi-line baseline with headers
  between the various alternative values. This facilitates updating
  the baseline again.

+ Support Python 3.8. Previously, when run using 3.8, the baseline
  update tool misplaced baseline updates in the first triple quoted
  string found above the baseline. (Python 3.8 stack frames now
  report the line number of the first line in a statement rather
  than the last.)

+ Change behavior of ``Baseline`` to use raw strings when updating
  baselines when possible to improve readability.

+ Deprecate ``RawBaseline`` since ``Baseline`` now incorporates
  its behavior.


***********
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
        JUMPS
    OVER 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
mis-compared value. When the interpreter 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
        JUMPS
    OVER 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!


https://baseline.readthedocs.io/en/latest/

Back to comp.lang.python.announce | Previous | Next | Find similar | Unroll thread


Thread

[baseline 1.0.0] Easy String Baseline Dan Gass <dan.gass@gmail.com> - 2020-03-29 23:45 -0500

csiph-web