{ "info": { "author": "Jon Parise", "author_email": "jon@indelible.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Framework :: Flake8", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Quality Assurance", "Topic :: Software Development :: Testing", "Topic :: Software Development :: Testing :: Unit" ], "description": "=================================\nFlake8 Unittest Assertion Checker\n=================================\n\n|PyPI Version| |Python Versions|\n\n``flake8-assertive`` is a `Flake8 `_ extension that\nencourages using richer, more specific `unittest`_ assertions beyond just the\ntypical ``assertEqual(a, b)`` and ``assertTrue(x)`` methods. The suggested\nmethods perform more precise checks and provide better failure messages than\nthe generic methods.\n\n+------------------------------------------+-----------------------------------+------+\n| Original | Suggestion | Code |\n+==========================================+===================================+======+\n| ``assertTrue(a == b)`` | ``assertEqual(a, b)`` | A500 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertTrue(a != b)`` | ``assertNotEqual(a, b)`` | A500 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertFalse(a == b)`` | ``assertNotEqual(a, b)`` | A500 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertFalse(a != b)`` | ``assertEqual(a, b)`` | A500 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertTrue(a < b)`` | ``assertLess(a, b)`` | A500 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertTrue(a <= b)`` | ``assertLessEqual(a, b)`` | A500 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertTrue(a > b)`` | ``assertGreater(a, b)`` | A500 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertTrue(a >= b)`` | ``assertGreaterEqual(a, b)`` | A500 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertTrue(a is b)`` | ``assertIs(a, b)`` | A501 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertTrue(a is not b)`` | ``assertIsNot(a, b)`` | A501 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertFalse(a is b)`` | ``assertNotIs(a, b)`` | A501 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertFalse(a is not b)`` | ``assertIs(a, b)`` | A501 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertTrue(a in b)`` | ``assertIn(a, b)`` | A501 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertFalse(a in b)`` | ``assertNotIn(a, b)`` | A501 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertTrue(isinstance(a, b))`` | ``assertIsInstance(a, b)`` | A501 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertFalse(isinstance(a, b))`` | ``assertNotIsInstance(a, b)`` | A501 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertEqual(a, round(b, x))`` | ``assertAlmostEqual(a, b, x)`` | A501 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertAlmostEqual(a, round(b, x))`` | ``assertAlmostEqual(a, b, x)`` | A501 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertNotEqual(a, round(b, x))`` | ``assertNotAlmostEqual(a, b, x)`` | A501 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertNotAlmostEqual(a, round(b, x))`` | ``assertNotAlmostEqual(a, b, x)`` | A501 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertEqual(a, None)`` | ``assertIsNone(a)`` | A502 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertNotEqual(a, None)`` | ``assertIsNotNone(a)`` | A502 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertTrue(a is None)`` | ``assertIsNone(a)`` | A502 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertTrue(a is not None)`` | ``assertIsNotNone(a)`` | A502 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertFalse(a is None)`` | ``assertIsNotNone(a)`` | A502 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertFalse(a is not None)`` | ``assertIsNone(a)`` | A502 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertEqual(a, True)`` | ``assertTrue(a)`` | A502 |\n+------------------------------------------+-----------------------------------+------+\n| ``assertEqual(a, False)`` | ``assertFalse(a)`` | A502 |\n+------------------------------------------+-----------------------------------+------+\n\nNote that some suggestions are normalized forms of the original, such as when\na double-negative is used (``assertFalse(a != b)`` \u2192 ``assertEqual(a, b)``).\nThere aren't suggestions for things like ``assertFalse(a > b)``, which may or\nmay not be equivalent to ``assertLessEqual(a, b)``.\n\n\nInstallation\n------------\n\nInstall from PyPI using ``pip``:\n\n.. code-block:: sh\n\n $ pip install flake8-assertive\n\nThe extension will be activated automatically by ``flake8``. You can verify\nthat it has been loaded by inspecting the ``flake8 --version`` string.\n\n.. code-block:: sh\n\n $ flake8 --version\n 3.7.7 (assertive: 1.1.0, ...) CPython 2.7.16 on Darwin\n\n\nError Codes\n-----------\n\nThis extension adds three new `error codes`__ (using the ``A50`` prefix):\n\n- ``A500``: prefer *{func}* for '*{op}*' comparisons\n- ``A501``: prefer *{func}* for '*{op}*' expressions\n- ``A502``: prefer *{func}* instead of comparing to *{obj}*\n\n.. __: http://flake8.pycqa.org/en/latest/user/error-codes.html\n\nConfiguration\n-------------\n\nConfiguration values are specified in the ``[flake8]`` section of your `config\nfile`_ or as command line arguments (e.g. ``--assertive-snakecase``).\n\n- ``assertive-snakecase``: suggest snake_case assert method names\n (e.g. ``assert_true()``) instead of the standard names (e.g. ``assertTrue()``)\n- ``assertive-test-pattern``: `fnmatch`_ pattern for identifying unittest test\n files (and all other files will be skipped)\n\n.. _fnmatch: https://docs.python.org/library/fnmatch.html\n.. _unittest: https://docs.python.org/library/unittest.html\n.. _config file: http://flake8.pycqa.org/en/latest/user/configuration.html\n\nCaveats\n-------\n\nThere are some specific cases when the suggestion might not match the intent\nof the original.\n\nTesting the equality operator\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n``assertEqual()`` won't use the ``==`` operator if the comparison has been\ndelegated to a `type-specific equalilty function`__. By default, this is the\ncase for strings, sequences, lists, tuples, sets, and dicts.\n\n.. __: https://docs.python.org/3/library/unittest.html#unittest.TestCase.addTypeEqualityFunc\n\nIf your intent is to specifically test the ``==`` operator, consider writing\nthe assertion like this instead:\n\n.. code-block:: python\n\n assertIs(a == b, True)\n\nThis approach has the benefit of verifying that the type's ``__eq__``\nimplementation returns a boolean value. Unfortunately, it also has the\ndownside of reporting the result of ``a == b`` on failure instead of the\nvalues of ``a`` and ``b``.\n\nSuggested by: `Serhiy Storchaka `_\n\n.. |PyPI Version| image:: https://img.shields.io/pypi/v/flake8-assertive.svg\n :target: https://pypi.python.org/pypi/flake8-assertive\n.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/flake8-assertive.svg\n :target: https://pypi.python.org/pypi/flake8-assertive\n\n\nChanges\n=======\n\n1.1.0 (2019-06-26)\n------------------\n\n* Suggest ``assertAlmostEqual(a, b, x)`` for ``round()`` expressions like in\n ``assertEqual(a, round(b, x))`` and ``assertAlmostEqual(a, round(b, x))``\n (and similar for ``assertNotEqual()`` and ``assertNotAlmostEqual()``.\n* Recognize ``assertAmostEquals()`` and ``assertNotAlmostEquals()`` as aliases\n for ``assertAlmostEqual()`` and ``assertNotAlmostEqual()``.\n* Drop Python 3.4 as a supported version since it has been officially retired.\n\n1.0.1 (2018-07-03)\n------------------\n\n* Don't make suggestions for assertions containing multiple comparison\n operations (e.g. ``assertTrue(a == b == c)``).\n\n1.0.0 (2018-06-04)\n------------------\n\n* Suggest ``assertIsNone(a)`` for ``assertTrue(a is None)``, etc.\n* Recognize ``assertEquals()`` and ``assertNotEquals()`` as aliases for\n ``assertEqual()`` and ``assertNotEqual()``.\n\n0.9.0 (2018-05-14)\n------------------\n\n* Initial beta release\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/jparise/flake8-assertive/tarball/1.1.0", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jparise/flake8-assertive", "keywords": "flake8 testing unittest assert", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "flake8-assertive", "package_url": "https://pypi.org/project/flake8-assertive/", "platform": "", "project_url": "https://pypi.org/project/flake8-assertive/", "project_urls": { "Download": "https://github.com/jparise/flake8-assertive/tarball/1.1.0", "Homepage": "https://github.com/jparise/flake8-assertive" }, "release_url": "https://pypi.org/project/flake8-assertive/1.1.0/", "requires_dist": [ "flake8" ], "requires_python": "", "summary": "Flake8 unittest assert method checker", "version": "1.1.0" }, "last_serial": 5452642, "releases": { "0.9.0": [ { "comment_text": "", "digests": { "md5": "7b7524fdfc335b3443b63a363b311f23", "sha256": "3b4c09a3cbfa52d83a6ec3be476fd280f2363a591c8a1f0208dcda5677002988" }, "downloads": -1, "filename": "flake8_assertive-0.9.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7b7524fdfc335b3443b63a363b311f23", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5438, "upload_time": "2018-05-14T19:47:01", "url": "https://files.pythonhosted.org/packages/7b/cf/09e19a6f56b3bd75f3a123050654297573dcf3e647a9c3b90f883057049d/flake8_assertive-0.9.0-py2.py3-none-any.whl" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "8aad5551aa9f676d295f5692017456ae", "sha256": "222d39d2ca6fd58a260fd0f2d8b86db170ec31f6696b320b4d01a7f67682c98d" }, "downloads": -1, "filename": "flake8_assertive-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8aad5551aa9f676d295f5692017456ae", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5585, "upload_time": "2018-06-04T16:46:52", "url": "https://files.pythonhosted.org/packages/78/52/18ae0a63ae2466eaedf6ab4af51612f998afbbd4da93aba9ecee7906f67a/flake8_assertive-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "157042618a2c6928d57eb3467233e02a", "sha256": "7b65e8bdbe1eab101e0e9df78604b39ad89bde24297ca8aa7dd795ec87478c67" }, "downloads": -1, "filename": "flake8-assertive-1.0.0.tar.gz", "has_sig": false, "md5_digest": "157042618a2c6928d57eb3467233e02a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6204, "upload_time": "2018-06-04T16:46:53", "url": "https://files.pythonhosted.org/packages/40/5f/24bb530168e14f02b707a27e7aea5f5ff5431485876166c83e12dfda30c5/flake8-assertive-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "2d1ff4d24036a8948cd07280f395c2a7", "sha256": "ca51b155a968fb65193d8ddfce76250b809d379e7026b6ba819eb37bf04d5fe1" }, "downloads": -1, "filename": "flake8_assertive-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2d1ff4d24036a8948cd07280f395c2a7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5658, "upload_time": "2018-07-03T17:44:19", "url": "https://files.pythonhosted.org/packages/20/9a/a88f714c8943dfc832714e677859f5998ca7f7e516fe4904c21091fec3cb/flake8_assertive-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f1db9a6e2440d71680cb65869fbc4015", "sha256": "6894b1069560635a6dc48505c0f8bf9b189fc227862670258c9f687fdffc52f2" }, "downloads": -1, "filename": "flake8-assertive-1.0.1.tar.gz", "has_sig": false, "md5_digest": "f1db9a6e2440d71680cb65869fbc4015", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6376, "upload_time": "2018-07-03T17:44:20", "url": "https://files.pythonhosted.org/packages/2c/b7/b164fa95daf4a666e7ca48a0454a5288727704d193a550df87b9eb38a332/flake8-assertive-1.0.1.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "9b7b516594defdb44888ab585696497c", "sha256": "dd66ccd5cb15d01c8aaaa5f82d66af534f50fdac7b1e0cec3153e3288f8dec5a" }, "downloads": -1, "filename": "flake8_assertive-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9b7b516594defdb44888ab585696497c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7141, "upload_time": "2019-06-26T16:39:13", "url": "https://files.pythonhosted.org/packages/f6/97/dab6349ad06403918fcafd21e90829181ffb4161375f6871a4d45803f6ca/flake8_assertive-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "70f2cce3b1e10e0e8355cf950aa0a804", "sha256": "06e98538ebc6252476d0af6a50d7277a065dceb53adab2da418a9df6c977ebe2" }, "downloads": -1, "filename": "flake8-assertive-1.1.0.tar.gz", "has_sig": false, "md5_digest": "70f2cce3b1e10e0e8355cf950aa0a804", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7272, "upload_time": "2019-06-26T16:39:15", "url": "https://files.pythonhosted.org/packages/bc/fe/26a428845c3332d0cd4802f8a12fe90fe3b727fa510780e10a9dc5a6d85e/flake8-assertive-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9b7b516594defdb44888ab585696497c", "sha256": "dd66ccd5cb15d01c8aaaa5f82d66af534f50fdac7b1e0cec3153e3288f8dec5a" }, "downloads": -1, "filename": "flake8_assertive-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9b7b516594defdb44888ab585696497c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7141, "upload_time": "2019-06-26T16:39:13", "url": "https://files.pythonhosted.org/packages/f6/97/dab6349ad06403918fcafd21e90829181ffb4161375f6871a4d45803f6ca/flake8_assertive-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "70f2cce3b1e10e0e8355cf950aa0a804", "sha256": "06e98538ebc6252476d0af6a50d7277a065dceb53adab2da418a9df6c977ebe2" }, "downloads": -1, "filename": "flake8-assertive-1.1.0.tar.gz", "has_sig": false, "md5_digest": "70f2cce3b1e10e0e8355cf950aa0a804", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7272, "upload_time": "2019-06-26T16:39:15", "url": "https://files.pythonhosted.org/packages/bc/fe/26a428845c3332d0cd4802f8a12fe90fe3b727fa510780e10a9dc5a6d85e/flake8-assertive-1.1.0.tar.gz" } ] }