grappa


Namegrappa JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/grappa-py/grappa
SummaryBehavior-oriented, expressive, developer-friendly assertions library
upload_time2020-11-21 20:37:06
maintainer
docs_urlNone
authorTomas Aparicio
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements colorama six
Travis-CI
coveralls test coverage No coveralls.
            .. image:: http://i.imgur.com/kKZPYut.jpg
   :width: 100%
   :alt: grappa logo
   :align: center


|Build Status| |PyPI| |Coverage Status| |Documentation Status| |Stability| |Quality| |Versions| |SayThanks|

About
-----

``grappa`` is a behavior-oriented, self-declarative, expressive and developer-friendly
lightweight assertion library for Python_ that aims to make testing more productive and frictionless for humans.

``grappa`` comes with two declarative `assertion styles`_: ``expect`` and ``should``.

It also comes with a detailed, human-friendly `error reporting`_ system that aims to reduce friction,
provide better feedback and improve human speed and agility while identifying and fixing errors.

To get started, take a look to the `showcase`_ code, `tutorial`_, available `plugins`_ and `operators documentation`_.

For HTTP protocol assertions, see `grappa-http`_.

Status
------

``grappa`` is considered **stable** software, however it's not mature, widely used software. 
New features may be added from time to time or minor bugs may be experienced.

Community contributions and bug reports are very welcome.

Showcase
--------

A small example demonstrating some `grappa` features.
See `documentation`_ and `tutorial`_ for more examples.

.. code-block:: python

    from grappa import should

    True | should.be.true
    False | should.be.false
    None | should.be.none

    '' | should.be.empty
    [] | should.be.empty
    'foo' | should.exists

    3.14 | should.be.lower.than(4)
    3.14 | should.be.higher.than(3)
    3.14 | should.be.within(2, 4)

    'bar' | should.be.equal.to('bar', msg='value is not "bar"')
    [1, 2, 3] | should.be.equal.to([1, 2, 3])

    'hello, grappa' | should.startswith('hello')
    'hello, grappa' | should.endswith('grappa')
    [1, 2, 3, 4] | should.startswith(1)
    [1, 2, 3, 4] | should.endswith(4)

    'Hello grappa' | should.match('(\W)+ grappa$')
    'Hello grappa' | should.contain('grappa') | should.contain('he')
    ['foo', 'bar'] | should.contain('foo') | should.do_not.contain('baz')

    'foo' | should.be.a('string')
    {'foo': True} | should.be.a('dict')

    iter([1, 2, 3]) | should.have.length.of(3)
    [1, 2, 3] | should.be.a('list') > should.have.length.of(3)

    (lambda x: x) | should.be.callable
    (lambda x: x) | should.not_have.type.of('generator')

    'foo' | should.pass_test(lambda x: x in 'foo bar')
    'foo' | should.pass_function(lambda x: len(x) > 2)

    (lambda: x) | should.raises(NameError)
    (lambda: x) | should.does_not.raises(RuntimeError)

    {'foo': 'bar'} | should.have.key('foo').that.should.be.equal('bar')
    (1, 2, 3, 4) | should.be.a(tuple) > should.have.index.at(3) > should.be.equal.to(4)

    an_object | should.have.properties('foo', 'bar', 'baz')
    an_object | should.implement.methods('foo', 'bar', 'baz')

    {'foo': True, 'bar': False} | should.all(should.have.key('foo'), should.have.key('bar'))
    {'foo': True, 'bar': False} | should.any(should.have.key('foo'), should.have.key('baz'))

    ({'bar': [1, 2, 3]}
        | should.have.key('bar')
        > should.be.a('list')
        > should.have.length.of(3)
        > should.contain.item(3)
        > should.have.index.at(1)
        > should.be.equal.to(2))

    with should('foo'):
        should.be.a(str)
        should.have.length.of(3)
        should.be.equal.to('foo')


Let's see how the error report looks like in ``grappa`` running in ``pytest``.

See `error reporting`_ documentation for more details about how ``grappa`` error report system works.

.. code-block:: python

    ======================================================================
    FAIL: tests.should_test.test_grappa_assert
    ======================================================================
    Traceback (most recent call last):
    File ".pyenv/versions/3.6.0/lib/python3.6/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
    File "grappa/tests/should_test.py", line 16, in test_grappa_assert
    x | should.be.have.length.of(4)
    File "grappa/grappa/test.py", line 248, in __ror__
    return self.__overload__(value)
    File "grappa/grappa/test.py", line 236, in __overload__
    return self.__call__(subject, overload=True)
    File "grappa/grappa/test.py", line 108, in __call__
    return self._trigger() if overload else Test(subject)
    File "grappa/grappa/test.py", line 153, in _trigger
    raise err
    AssertionError: Oops! Something went wrong!

    The following assertion was not satisfied
      subject "[1, 2, 3]" should be have length of "4"

    Message
      subject list must have at least 4 items

    Reasons
      ▸ unexpected object length: 3

    What we expected
      an object that can be length measured and its length is equal to 4

    What we got instead
      an object of type "list" with length 3

    Information
      ▸ Object length is measured by using "len()" built-in
        Python function or consuming an lazy iterable, such as a
        generator. Most built-in types and objects in Python
        can be tested that way, such as str, list, tuple, dict...
        as well as any object that implements "__len__()" method.
        — Reference: https://docs.python.org/3/library/functions.html#len

    Where
      File "grappa/tests/should_test.py", line 16, in test_grappa_assert

     8|
     9|  def test_native_assert():
    10|      x = [1, 2, 3]
    11|      assert len(x) == 4
    12|
    13|
    14|  def test_grappa_assert():
    15|      x = [1, 2, 3]
    16| >    x | should.be.have.length.of(4)
    17|
    18|
    19|  def test_bool():
    20|      True | should.be.true | should.be.present
    21|      False | should.be.false | should.be.equal.to(False)
    22|      False | should.be.false | should.not_be.equal.to(True)

Demo
----

.. image:: https://asciinema.org/a/d6yd2475m41thdku7d3ntkeir.png
   :width: 900
   :alt: showcase
   :align: center
   :target: https://asciinema.org/a/d6yd2475m41thdku7d3ntkeir?autoplay=1&speed=3&size=small

Why grappa?
-----------

``grappa`` aims to assist humans while doing a very recurrent and not very fun task in software development: testing things.

The core idea behind ``grappa`` comes from the fact that human time is considerably more expensive than machine time,
and therefore any machine assistance to optimize processes and close the gap is beneficial.

With ``grappa`` you can express almost in plain English what the test contract actually is, but in a way that's
fun and easy to write but also more easy and pleasant to read or maintain by other developers.


The Zen of grappa
-----------------

- Testing is about feedback: detailed, easy to understand, human-friendly is always better.
- Frictionless testing: introducing self-declarative behavior testing patterns can make testing more fun for test writers and more enjoyable for test readers.
- Expressivity is paramount: humans should easily understand what the code is doing.
- Human time is expensive: any modern software should assist people to identify and understand errors easily.
- Make error reporting great again: feedback during testing is key, let's make it more handy and less frustrating.
- Testing patterns consolidation: software expectations are limited to the boundaries of language data types and structures.
- Hurt less feelings: seeing errors is not a nice thing, but it can be painless if details are showed you in a more gentle way.


Features
--------

-  Behavior-oriented expressive fluent API.
-  Built-in assertion DSL with English lexicon and semantics.
-  Supports both ``expect`` and ``should`` assertion styles.
-  Full-featured built-in `assertion operators`_.
-  Human-friendly and detailed `error reporting`_.
-  Built-in expectations difference comparison between subject and expected values.
-  Extensible assertions supporting third-party `plugins`_.
-  Assertion chaining and composition.
-  Composable assertion via logical operators such as ``and`` & ``or``.
-  Testing framework agnostic. Works with ``unittest``, ``nosetests``, ``pytest``, ``behave`` ...
-  Easy to hack via programmatic API.
-  Lightweight and (almost) dependency-free.
-  Works with Python 2.7+, 3+, PyPy and potentially with other Python implementations.


Installation
------------

Using ``pip`` package manager:

.. code-block:: bash

    pip install --upgrade grappa

Or install the latest sources from Github:

.. code-block:: bash

    pip install -e git+git://github.com/grappa-py/grappa.git#egg=grappa


.. _Python: http://python.org
.. _`documentation`: http://grappa.readthedocs.io
.. _`operators documentation`: http://grappa.readthedocs.io/en/latest/operators.html
.. _`tutorial`: http://grappa.readthedocs.io/en/latest/tutorial.html
.. _`plugins`: http://grappa.readthedocs.io/en/latest/plugins.html
.. _`error reporting`: http://grappa.readthedocs.io/en/latest/errors.html
.. _`assertion styles`: http://grappa.readthedocs.io/en/latest/style.html
.. _`assertion operators`: http://grappa.readthedocs.io/en/latest/operators.html
.. _`grappa-http`: https://github.com/grappa-py/http

.. |Build Status| image:: https://travis-ci.org/grappa-py/grappa.svg?branch=master
   :target: https://travis-ci.org/grappa-py/grappa
.. |PyPI| image:: https://img.shields.io/pypi/v/grappa.svg?maxAge=2592000?style=flat-square
   :target: https://pypi.python.org/pypi/grappa
.. |Coverage Status| image:: https://coveralls.io/repos/github/grappa-py/grappa/badge.svg?branch=master
   :target: https://coveralls.io/github/grappa-py/grappa?branch=master
.. |Documentation Status| image:: https://readthedocs.org/projects/grappa/badge/?version=latest
   :target: http://grappa.readthedocs.io/en/latest/?badge=latest
.. |Quality| image:: https://codeclimate.com/github/grappa-py/grappa/badges/gpa.svg
   :target: https://codeclimate.com/github/grappa-py/grappa
   :alt: Code Climate
.. |Stability| image:: https://img.shields.io/pypi/status/grappa.svg
   :target: https://pypi.python.org/pypi/grappa
   :alt: Stability
.. |Versions| image:: https://img.shields.io/pypi/pyversions/grappa.svg
   :target: https://pypi.python.org/pypi/grappa
   :alt: Python Versions
.. |SayThanks| image:: https://img.shields.io/badge/Say%20Thanks!-%F0%9F%A6%89-1EAEDB.svg
   :target: https://saythanks.io/to/h2non
   :alt: Say Thanks



History
=======

1.0.1 / 2020-11-21
------------------

  * Merge pull request #65 from sgissinger/master
  * 2.7 correction (maybe)
  * fixes #54 add message redirection to exceptions

1.0.0 / 2020-11-21
------------------

  * feat: major version v1
  * fix: #53, #55, #48, #59 (credits to sgissinger)
  * feat: added mock call operators (credits to sgissinger)
  * make github actions fail on every flake8
  * pass flake8
  * enforce implements operator
  * missing kwargs argument
  * add contain tests
  * normalize code between contain and key and add lists expectations to contain
  * improve been_called_with reasons when false
  * use os.path.join instead of remove and Foo class for spy tests
  * os.path.basename not a good candidate to count mock calls because it seems to call itself
  * missing experimental for pypy2
  * re-try to use pypy2 on github actions
  * skip tests which does not work on pypy2
  * add contain tests
  * contain now supports dicts and arrays. Partially fix #59
  * use isinstance
  * improve keys operator tests and add array tests
  * keys operator now supports arrays
  * set env var in step only
  * allow errors on 3.10-dev builds
  * allow insecure commands for github action nightly
  * upgrade action version
  * run 3.10-dev on ubuntu only
  * add python 3.10 nightly to github action pipeline
  * set 50 chars to normalization size
  * flake8 correction and docstrings upgrade
  * add key operator tests
  * key operator simplified and works with tuples, lists and sets. fixes #48 ?
  * do not upgrade pip on github actions
  * try to use pypy only on ubuntu for github actions
  * use only include for pypy
  * add python 3.9, prefer jobs over matrix, add pypy env var in travis ci
  * add mocker stop all
  * add python 3.9 to github actions
  * pypy2 does not seem to work in github actions like it does in TravisCI
  * exclude pypy2 on ubuntu
  * exclude macos pypy2 from ci matrix
  * use pypy2 instead
  * add pypy to github actions
  * Create python-package.yml
  * added mock impl validator docstring and error tips
  * added explicit docstrings to have_been operators
  * use pytest-mock 2.0.0 for python 2.7
  * make flake8 pass
  * set exception __cause__ to get direct causes when internal exceptions occurs
  * move mock implementation to decorators module
  * add tests using pytest-mock spies and stubs which are basic funcs
  * do not rely explicitly on MagicMock but test needed implementation
  * better get attribute handling
  * better called once messages
  * add been_called operator tests
  * add been_called operators
  * missing end line
  * fixes #55 should.not_have.key(...)
  * once negated a sentence stays negated
  * make accessor be called
  * fix(Makefile): lovely tabs
  * fix(Makefile): use twine for publishing

0.1.12 / 2020-02-26
--------------------

  * feat(version): bimp
  * feat(setup): add python 3.7 & 3.8 classifiers
  * Merge pull request #56 from jdlourenco/collections-abc-six
  * update code according flake8 warnings and errors
  * feat(requirements): bump flake8
  * feat(travis): add python 3.7 & 3.8
  * fix(travis): remove python 3.3 & 3.4
  * change bump six to 0.14
  * change use six.moves.collections_abc module for importing classes that moved to the collections.abc module on python3

0.1.10 / 2018-10-02
-------------------

   * feat: add ``only`` operator #45

0.1.9 / 2018-06-02
------------------

   * fix(#42): Add string comparison parity for Python 2.7

v0.1.8 / 2018-01-23
-------------------

  * Merge pull request #39 from dancingcactus/master
  * Removes unused imports
  * Allow partials to be used with raises operators
  * fix(operator): minor type in exception message
  * Merge pull request #38 from dancingcactus/master
  * Updates the docs for Raises to encapsulate feedback from #37
  * Update README.rst
  * refactor(docs): remove codesponsor
  * feat(docs): add sponsor ad
  * feat(docs): update status note
  * feat(docs): update status note
  * Merge branch 'master' of https://github.com/grappa-py/grappa
  * fix(docs): use proper organization name
  * Update AUTHORS
  * refactor(docs): import AUTHORS file
  * feat: add AUTHORS file
  * fix(setup.py): update package URL

v0.1.7 / 2017-05-12
-------------------

  * feat(#33): show available operators on attribute error
  * feat(#36): add allowed assertion attributes on error

v0.1.6 / 2017-04-28
-------------------

* fix(type): expose proper type value if a type value is the expected value
* fix(reporter): use search() instead of match() for line code matching. fix(reporters): escape underscore sequences

v0.1.5 / 2017-04-28
-------------------

* feat(reporters): add code reporter
* feat(operators): add "that_is", "which_is" attribute DSL operators
* refactor(reporter): match additional negation assertions

v0.1.4 / 2017-04-27
-------------------

* feat(reporters): match attribute expressions for proper code line reporting
* feat(equal): enable show_diff report in operator
* fix(index_test): bad file formatting
* refactor(index_test): add error test case
* refactor(index_test): remove commented code
* feat(docs): add context assertion example in tutorial
* feat(docs): add context manager example
* fix(docs): update error exception example
* refactor(docs): update showcase example
* feat(operators): add not_satisfy attribute operator

v0.1.3 / 2017-03-29
-------------------

* feat(docs): add raise exception examples
* refactor(docs): update showcase example
* feat(reporter): normalize value output in subject/expect sections
* feat(docs): update examples and FAQs. feat(operators): add aliases for start/end operator
* feat(docs): add link to grappa-http plugin
* refactor(docs): add operators type section
* refactor(docs): add beta status documentation notice
* feat(docs): update description
* refactor(docs): update status description
* feat(docs): update links

v0.1.2 / 2017-03-26
-------------------

* feat(docs): add matchers supported keyword arguments
* feat(docs): improve descriptions
* feat(operators): improve length operator for access based chaining
* fix(docs): update error custom message example
* feat(docs): improve documentation. adds operators composition section
* fix(setup.py): add author email

v0.1.1 / 2017-03-23
-------------------

* refactor(diff): process expected values as tuple first
* fix(contain): remove print statements
* refactor(core): normalize yielding syntax, add missing documentation
* refactor(core): normalize yielding syntax, add missing documentation
* feat(#26): support disable operator chaining
* feat(#28): better assertion reporting. feat(operators): add index operator
* refactor(reporter): support raw mode with proper indent pretty printing
* refactor(operators): add satisfy/satisfies attribute operators
* feat(diff): consume diff specific subject/expected values
* feat(operators): add is/is_not operator attributes
* refactor(core): isolate reporters per module
* feat(#13, #25): add suboperators support and diff output report
* refactor(docs): update organization name
* refactor(docs): update project image
* refactor(reporter): ignore subject/expected output if empty
* refactor(reporter): show diff if enabled
* feat(docs): add in a nutshell section
* feat(#24, #25): feature enhancements
* feat(docs): add say thanks badge
* refactor(reporter): load value from operator first
* fix(docs): use proper badges
* fix(docs): update type operator examples
* fix(metadata): update
* refactor(test): add chained test for keys
* feat(Makefile): add publish commands

0.1.0 (2017-03-05)
------------------

* First version (beta)



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/grappa-py/grappa",
    "name": "grappa",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Tomas Aparicio",
    "author_email": "tomas@aparicio.me",
    "download_url": "https://files.pythonhosted.org/packages/a6/98/ccdd1165ed8de818d7b31d245903a8544a3da31fbc4aa37a371c0a85d8f4/grappa-1.0.1.tar.gz",
    "platform": "",
    "description": ".. image:: http://i.imgur.com/kKZPYut.jpg\n   :width: 100%\n   :alt: grappa logo\n   :align: center\n\n\n|Build Status| |PyPI| |Coverage Status| |Documentation Status| |Stability| |Quality| |Versions| |SayThanks|\n\nAbout\n-----\n\n``grappa`` is a behavior-oriented, self-declarative, expressive and developer-friendly\nlightweight assertion library for Python_ that aims to make testing more productive and frictionless for humans.\n\n``grappa`` comes with two declarative `assertion styles`_: ``expect`` and ``should``.\n\nIt also comes with a detailed, human-friendly `error reporting`_ system that aims to reduce friction,\nprovide better feedback and improve human speed and agility while identifying and fixing errors.\n\nTo get started, take a look to the `showcase`_ code, `tutorial`_, available `plugins`_ and `operators documentation`_.\n\nFor HTTP protocol assertions, see `grappa-http`_.\n\nStatus\n------\n\n``grappa`` is considered **stable** software, however it's not mature, widely used software. \nNew features may be added from time to time or minor bugs may be experienced.\n\nCommunity contributions and bug reports are very welcome.\n\nShowcase\n--------\n\nA small example demonstrating some `grappa` features.\nSee `documentation`_ and `tutorial`_ for more examples.\n\n.. code-block:: python\n\n    from grappa import should\n\n    True | should.be.true\n    False | should.be.false\n    None | should.be.none\n\n    '' | should.be.empty\n    [] | should.be.empty\n    'foo' | should.exists\n\n    3.14 | should.be.lower.than(4)\n    3.14 | should.be.higher.than(3)\n    3.14 | should.be.within(2, 4)\n\n    'bar' | should.be.equal.to('bar', msg='value is not \"bar\"')\n    [1, 2, 3] | should.be.equal.to([1, 2, 3])\n\n    'hello, grappa' | should.startswith('hello')\n    'hello, grappa' | should.endswith('grappa')\n    [1, 2, 3, 4] | should.startswith(1)\n    [1, 2, 3, 4] | should.endswith(4)\n\n    'Hello grappa' | should.match('(\\W)+ grappa$')\n    'Hello grappa' | should.contain('grappa') | should.contain('he')\n    ['foo', 'bar'] | should.contain('foo') | should.do_not.contain('baz')\n\n    'foo' | should.be.a('string')\n    {'foo': True} | should.be.a('dict')\n\n    iter([1, 2, 3]) | should.have.length.of(3)\n    [1, 2, 3] | should.be.a('list') > should.have.length.of(3)\n\n    (lambda x: x) | should.be.callable\n    (lambda x: x) | should.not_have.type.of('generator')\n\n    'foo' | should.pass_test(lambda x: x in 'foo bar')\n    'foo' | should.pass_function(lambda x: len(x) > 2)\n\n    (lambda: x) | should.raises(NameError)\n    (lambda: x) | should.does_not.raises(RuntimeError)\n\n    {'foo': 'bar'} | should.have.key('foo').that.should.be.equal('bar')\n    (1, 2, 3, 4) | should.be.a(tuple) > should.have.index.at(3) > should.be.equal.to(4)\n\n    an_object | should.have.properties('foo', 'bar', 'baz')\n    an_object | should.implement.methods('foo', 'bar', 'baz')\n\n    {'foo': True, 'bar': False} | should.all(should.have.key('foo'), should.have.key('bar'))\n    {'foo': True, 'bar': False} | should.any(should.have.key('foo'), should.have.key('baz'))\n\n    ({'bar': [1, 2, 3]}\n        | should.have.key('bar')\n        > should.be.a('list')\n        > should.have.length.of(3)\n        > should.contain.item(3)\n        > should.have.index.at(1)\n        > should.be.equal.to(2))\n\n    with should('foo'):\n        should.be.a(str)\n        should.have.length.of(3)\n        should.be.equal.to('foo')\n\n\nLet's see how the error report looks like in ``grappa`` running in ``pytest``.\n\nSee `error reporting`_ documentation for more details about how ``grappa`` error report system works.\n\n.. code-block:: python\n\n    ======================================================================\n    FAIL: tests.should_test.test_grappa_assert\n    ======================================================================\n    Traceback (most recent call last):\n    File \".pyenv/versions/3.6.0/lib/python3.6/site-packages/nose/case.py\", line 198, in runTest\n    self.test(*self.arg)\n    File \"grappa/tests/should_test.py\", line 16, in test_grappa_assert\n    x | should.be.have.length.of(4)\n    File \"grappa/grappa/test.py\", line 248, in __ror__\n    return self.__overload__(value)\n    File \"grappa/grappa/test.py\", line 236, in __overload__\n    return self.__call__(subject, overload=True)\n    File \"grappa/grappa/test.py\", line 108, in __call__\n    return self._trigger() if overload else Test(subject)\n    File \"grappa/grappa/test.py\", line 153, in _trigger\n    raise err\n    AssertionError: Oops! Something went wrong!\n\n    The following assertion was not satisfied\n      subject \"[1, 2, 3]\" should be have length of \"4\"\n\n    Message\n      subject list must have at least 4 items\n\n    Reasons\n      \u25b8 unexpected object length: 3\n\n    What we expected\n      an object that can be length measured and its length is equal to 4\n\n    What we got instead\n      an object of type \"list\" with length 3\n\n    Information\n      \u25b8 Object length is measured by using \"len()\" built-in\n        Python function or consuming an lazy iterable, such as a\n        generator. Most built-in types and objects in Python\n        can be tested that way, such as str, list, tuple, dict...\n        as well as any object that implements \"__len__()\" method.\n        \u2014 Reference: https://docs.python.org/3/library/functions.html#len\n\n    Where\n      File \"grappa/tests/should_test.py\", line 16, in test_grappa_assert\n\n     8|\n     9|  def test_native_assert():\n    10|      x = [1, 2, 3]\n    11|      assert len(x) == 4\n    12|\n    13|\n    14|  def test_grappa_assert():\n    15|      x = [1, 2, 3]\n    16| >    x | should.be.have.length.of(4)\n    17|\n    18|\n    19|  def test_bool():\n    20|      True | should.be.true | should.be.present\n    21|      False | should.be.false | should.be.equal.to(False)\n    22|      False | should.be.false | should.not_be.equal.to(True)\n\nDemo\n----\n\n.. image:: https://asciinema.org/a/d6yd2475m41thdku7d3ntkeir.png\n   :width: 900\n   :alt: showcase\n   :align: center\n   :target: https://asciinema.org/a/d6yd2475m41thdku7d3ntkeir?autoplay=1&speed=3&size=small\n\nWhy grappa?\n-----------\n\n``grappa`` aims to assist humans while doing a very recurrent and not very fun task in software development: testing things.\n\nThe core idea behind ``grappa`` comes from the fact that human time is considerably more expensive than machine time,\nand therefore any machine assistance to optimize processes and close the gap is beneficial.\n\nWith ``grappa`` you can express almost in plain English what the test contract actually is, but in a way that's\nfun and easy to write but also more easy and pleasant to read or maintain by other developers.\n\n\nThe Zen of grappa\n-----------------\n\n- Testing is about feedback: detailed, easy to understand, human-friendly is always better.\n- Frictionless testing: introducing self-declarative behavior testing patterns can make testing more fun for test writers and more enjoyable for test readers.\n- Expressivity is paramount: humans should easily understand what the code is doing.\n- Human time is expensive: any modern software should assist people to identify and understand errors easily.\n- Make error reporting great again: feedback during testing is key, let's make it more handy and less frustrating.\n- Testing patterns consolidation: software expectations are limited to the boundaries of language data types and structures.\n- Hurt less feelings: seeing errors is not a nice thing, but it can be painless if details are showed you in a more gentle way.\n\n\nFeatures\n--------\n\n-  Behavior-oriented expressive fluent API.\n-  Built-in assertion DSL with English lexicon and semantics.\n-  Supports both ``expect`` and ``should`` assertion styles.\n-  Full-featured built-in `assertion operators`_.\n-  Human-friendly and detailed `error reporting`_.\n-  Built-in expectations difference comparison between subject and expected values.\n-  Extensible assertions supporting third-party `plugins`_.\n-  Assertion chaining and composition.\n-  Composable assertion via logical operators such as ``and`` & ``or``.\n-  Testing framework agnostic. Works with ``unittest``, ``nosetests``, ``pytest``, ``behave`` ...\n-  Easy to hack via programmatic API.\n-  Lightweight and (almost) dependency-free.\n-  Works with Python 2.7+, 3+, PyPy and potentially with other Python implementations.\n\n\nInstallation\n------------\n\nUsing ``pip`` package manager:\n\n.. code-block:: bash\n\n    pip install --upgrade grappa\n\nOr install the latest sources from Github:\n\n.. code-block:: bash\n\n    pip install -e git+git://github.com/grappa-py/grappa.git#egg=grappa\n\n\n.. _Python: http://python.org\n.. _`documentation`: http://grappa.readthedocs.io\n.. _`operators documentation`: http://grappa.readthedocs.io/en/latest/operators.html\n.. _`tutorial`: http://grappa.readthedocs.io/en/latest/tutorial.html\n.. _`plugins`: http://grappa.readthedocs.io/en/latest/plugins.html\n.. _`error reporting`: http://grappa.readthedocs.io/en/latest/errors.html\n.. _`assertion styles`: http://grappa.readthedocs.io/en/latest/style.html\n.. _`assertion operators`: http://grappa.readthedocs.io/en/latest/operators.html\n.. _`grappa-http`: https://github.com/grappa-py/http\n\n.. |Build Status| image:: https://travis-ci.org/grappa-py/grappa.svg?branch=master\n   :target: https://travis-ci.org/grappa-py/grappa\n.. |PyPI| image:: https://img.shields.io/pypi/v/grappa.svg?maxAge=2592000?style=flat-square\n   :target: https://pypi.python.org/pypi/grappa\n.. |Coverage Status| image:: https://coveralls.io/repos/github/grappa-py/grappa/badge.svg?branch=master\n   :target: https://coveralls.io/github/grappa-py/grappa?branch=master\n.. |Documentation Status| image:: https://readthedocs.org/projects/grappa/badge/?version=latest\n   :target: http://grappa.readthedocs.io/en/latest/?badge=latest\n.. |Quality| image:: https://codeclimate.com/github/grappa-py/grappa/badges/gpa.svg\n   :target: https://codeclimate.com/github/grappa-py/grappa\n   :alt: Code Climate\n.. |Stability| image:: https://img.shields.io/pypi/status/grappa.svg\n   :target: https://pypi.python.org/pypi/grappa\n   :alt: Stability\n.. |Versions| image:: https://img.shields.io/pypi/pyversions/grappa.svg\n   :target: https://pypi.python.org/pypi/grappa\n   :alt: Python Versions\n.. |SayThanks| image:: https://img.shields.io/badge/Say%20Thanks!-%F0%9F%A6%89-1EAEDB.svg\n   :target: https://saythanks.io/to/h2non\n   :alt: Say Thanks\n\n\n\nHistory\n=======\n\n1.0.1 / 2020-11-21\n------------------\n\n  * Merge pull request #65 from sgissinger/master\n  * 2.7 correction (maybe)\n  * fixes #54 add message redirection to exceptions\n\n1.0.0 / 2020-11-21\n------------------\n\n  * feat: major version v1\n  * fix: #53, #55, #48, #59 (credits to sgissinger)\n  * feat: added mock call operators (credits to sgissinger)\n  * make github actions fail on every flake8\n  * pass flake8\n  * enforce implements operator\n  * missing kwargs argument\n  * add contain tests\n  * normalize code between contain and key and add lists expectations to contain\n  * improve been_called_with reasons when false\n  * use os.path.join instead of remove and Foo class for spy tests\n  * os.path.basename not a good candidate to count mock calls because it seems to call itself\n  * missing experimental for pypy2\n  * re-try to use pypy2 on github actions\n  * skip tests which does not work on pypy2\n  * add contain tests\n  * contain now supports dicts and arrays. Partially fix #59\n  * use isinstance\n  * improve keys operator tests and add array tests\n  * keys operator now supports arrays\n  * set env var in step only\n  * allow errors on 3.10-dev builds\n  * allow insecure commands for github action nightly\n  * upgrade action version\n  * run 3.10-dev on ubuntu only\n  * add python 3.10 nightly to github action pipeline\n  * set 50 chars to normalization size\n  * flake8 correction and docstrings upgrade\n  * add key operator tests\n  * key operator simplified and works with tuples, lists and sets. fixes #48 ?\n  * do not upgrade pip on github actions\n  * try to use pypy only on ubuntu for github actions\n  * use only include for pypy\n  * add python 3.9, prefer jobs over matrix, add pypy env var in travis ci\n  * add mocker stop all\n  * add python 3.9 to github actions\n  * pypy2 does not seem to work in github actions like it does in TravisCI\n  * exclude pypy2 on ubuntu\n  * exclude macos pypy2 from ci matrix\n  * use pypy2 instead\n  * add pypy to github actions\n  * Create python-package.yml\n  * added mock impl validator docstring and error tips\n  * added explicit docstrings to have_been operators\n  * use pytest-mock 2.0.0 for python 2.7\n  * make flake8 pass\n  * set exception __cause__ to get direct causes when internal exceptions occurs\n  * move mock implementation to decorators module\n  * add tests using pytest-mock spies and stubs which are basic funcs\n  * do not rely explicitly on MagicMock but test needed implementation\n  * better get attribute handling\n  * better called once messages\n  * add been_called operator tests\n  * add been_called operators\n  * missing end line\n  * fixes #55 should.not_have.key(...)\n  * once negated a sentence stays negated\n  * make accessor be called\n  * fix(Makefile): lovely tabs\n  * fix(Makefile): use twine for publishing\n\n0.1.12 / 2020-02-26\n--------------------\n\n  * feat(version): bimp\n  * feat(setup): add python 3.7 & 3.8 classifiers\n  * Merge pull request #56 from jdlourenco/collections-abc-six\n  * update code according flake8 warnings and errors\n  * feat(requirements): bump flake8\n  * feat(travis): add python 3.7 & 3.8\n  * fix(travis): remove python 3.3 & 3.4\n  * change bump six to 0.14\n  * change use six.moves.collections_abc module for importing classes that moved to the collections.abc module on python3\n\n0.1.10 / 2018-10-02\n-------------------\n\n   * feat: add ``only`` operator #45\n\n0.1.9 / 2018-06-02\n------------------\n\n   * fix(#42): Add string comparison parity for Python 2.7\n\nv0.1.8 / 2018-01-23\n-------------------\n\n  * Merge pull request #39 from dancingcactus/master\n  * Removes unused imports\n  * Allow partials to be used with raises operators\n  * fix(operator): minor type in exception message\n  * Merge pull request #38 from dancingcactus/master\n  * Updates the docs for Raises to encapsulate feedback from #37\n  * Update README.rst\n  * refactor(docs): remove codesponsor\n  * feat(docs): add sponsor ad\n  * feat(docs): update status note\n  * feat(docs): update status note\n  * Merge branch 'master' of https://github.com/grappa-py/grappa\n  * fix(docs): use proper organization name\n  * Update AUTHORS\n  * refactor(docs): import AUTHORS file\n  * feat: add AUTHORS file\n  * fix(setup.py): update package URL\n\nv0.1.7 / 2017-05-12\n-------------------\n\n  * feat(#33): show available operators on attribute error\n  * feat(#36): add allowed assertion attributes on error\n\nv0.1.6 / 2017-04-28\n-------------------\n\n* fix(type): expose proper type value if a type value is the expected value\n* fix(reporter): use search() instead of match() for line code matching. fix(reporters): escape underscore sequences\n\nv0.1.5 / 2017-04-28\n-------------------\n\n* feat(reporters): add code reporter\n* feat(operators): add \"that_is\", \"which_is\" attribute DSL operators\n* refactor(reporter): match additional negation assertions\n\nv0.1.4 / 2017-04-27\n-------------------\n\n* feat(reporters): match attribute expressions for proper code line reporting\n* feat(equal): enable show_diff report in operator\n* fix(index_test): bad file formatting\n* refactor(index_test): add error test case\n* refactor(index_test): remove commented code\n* feat(docs): add context assertion example in tutorial\n* feat(docs): add context manager example\n* fix(docs): update error exception example\n* refactor(docs): update showcase example\n* feat(operators): add not_satisfy attribute operator\n\nv0.1.3 / 2017-03-29\n-------------------\n\n* feat(docs): add raise exception examples\n* refactor(docs): update showcase example\n* feat(reporter): normalize value output in subject/expect sections\n* feat(docs): update examples and FAQs. feat(operators): add aliases for start/end operator\n* feat(docs): add link to grappa-http plugin\n* refactor(docs): add operators type section\n* refactor(docs): add beta status documentation notice\n* feat(docs): update description\n* refactor(docs): update status description\n* feat(docs): update links\n\nv0.1.2 / 2017-03-26\n-------------------\n\n* feat(docs): add matchers supported keyword arguments\n* feat(docs): improve descriptions\n* feat(operators): improve length operator for access based chaining\n* fix(docs): update error custom message example\n* feat(docs): improve documentation. adds operators composition section\n* fix(setup.py): add author email\n\nv0.1.1 / 2017-03-23\n-------------------\n\n* refactor(diff): process expected values as tuple first\n* fix(contain): remove print statements\n* refactor(core): normalize yielding syntax, add missing documentation\n* refactor(core): normalize yielding syntax, add missing documentation\n* feat(#26): support disable operator chaining\n* feat(#28): better assertion reporting. feat(operators): add index operator\n* refactor(reporter): support raw mode with proper indent pretty printing\n* refactor(operators): add satisfy/satisfies attribute operators\n* feat(diff): consume diff specific subject/expected values\n* feat(operators): add is/is_not operator attributes\n* refactor(core): isolate reporters per module\n* feat(#13, #25): add suboperators support and diff output report\n* refactor(docs): update organization name\n* refactor(docs): update project image\n* refactor(reporter): ignore subject/expected output if empty\n* refactor(reporter): show diff if enabled\n* feat(docs): add in a nutshell section\n* feat(#24, #25): feature enhancements\n* feat(docs): add say thanks badge\n* refactor(reporter): load value from operator first\n* fix(docs): use proper badges\n* fix(docs): update type operator examples\n* fix(metadata): update\n* refactor(test): add chained test for keys\n* feat(Makefile): add publish commands\n\n0.1.0 (2017-03-05)\n------------------\n\n* First version (beta)\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Behavior-oriented, expressive, developer-friendly assertions library",
    "version": "1.0.1",
    "project_urls": {
        "Homepage": "https://github.com/grappa-py/grappa"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6c88292606bdf9337760670b84485fbba768b527d25b7989319f844de08bd533",
                "md5": "9740575b3f27fdfc8d3d3d14830cdd91",
                "sha256": "33b924a942c290520974339d28c81c8c172af8923015712509f2119e33e1901c"
            },
            "downloads": -1,
            "filename": "grappa-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9740575b3f27fdfc8d3d3d14830cdd91",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 67686,
            "upload_time": "2020-11-21T20:37:03",
            "upload_time_iso_8601": "2020-11-21T20:37:03.840117Z",
            "url": "https://files.pythonhosted.org/packages/6c/88/292606bdf9337760670b84485fbba768b527d25b7989319f844de08bd533/grappa-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a698ccdd1165ed8de818d7b31d245903a8544a3da31fbc4aa37a371c0a85d8f4",
                "md5": "e698f3ace6e05f82caac4f459262b00a",
                "sha256": "7db7934d8158d913ce719ebe2a3ccd1a0077371a55d5270303ef4c4547091a7f"
            },
            "downloads": -1,
            "filename": "grappa-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e698f3ace6e05f82caac4f459262b00a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 48344,
            "upload_time": "2020-11-21T20:37:06",
            "upload_time_iso_8601": "2020-11-21T20:37:06.265254Z",
            "url": "https://files.pythonhosted.org/packages/a6/98/ccdd1165ed8de818d7b31d245903a8544a3da31fbc4aa37a371c0a85d8f4/grappa-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-11-21 20:37:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "grappa-py",
    "github_project": "grappa",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "colorama",
            "specs": [
                [
                    "<",
                    "2"
                ],
                [
                    ">=",
                    "0.3.9"
                ]
            ]
        },
        {
            "name": "six",
            "specs": [
                [
                    "~=",
                    "1.14"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "grappa"
}
        
Elapsed time: 0.11329s