[baseline 1.0.0] Easy String Baseline

JAYA KANOJIYA jaya16122000 at gmail.com
Mon Mar 30 10:01:46 EDT 2020


how can we complete this project......
For this project, you’ll create a “word cloud” from a text by writing a
script. This script needs to process the text, remove punctuation, count
the frequencies, and ignore uninteresting or irrelevant words.

On Mon, Mar 30, 2020 at 6:00 PM Dan Gass <dan.gass at gmail.com> wrote:

> 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/
> --
> Python-announce-list mailing list -- python-announce-list at python.org
> To unsubscribe send an email to python-announce-list-leave at python.org
> https://mail.python.org/mailman3/lists/python-announce-list.python.org/
>
>         Support the Python Software Foundation:
>         http://www.python.org/psf/donations/
>


More information about the Python-list mailing list