{ "info": { "author": "Rudy Lattae", "author_email": "rudylattae@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: Microsoft :: Windows", "Programming Language :: Python", "Programming Language :: Python :: 2.7" ], "description": ".. _compare page on PyPI: http://pypi.python.org/pypi/compare\n.. _compare.py: https://github.com/rudylattae/compare/raw/master/compare.py\n.. _create an issue: https://github.com/rudylattae/compare/issues\n.. _unittest: http://docs.python.org/library/unittest.html\n.. _Python Standard Library: http://docs.python.org/library/\n\nOverview\n========\n\nCompare is a compact utility that provides an alternative, expressive \nsyntax for comparing data values. Have you been looking for an escape \nfrom the stale XUnit style asserts that plague the omni-present unittest_? \nYou may have found just what you need. I invite you to take a look at this \nlittle utility. If it fits your style, you may use it as a drop-in \nreplacement for the \"self.assert...\" style of doing assertions in python.\n\nThe compare API exposes the **expect** construct which allows \nyou to compare values with readable and extensible syntax. It was designed \nto be a stand-alone alternative assertion syntax. As such you may use it \nas-is with your favorite testing/specification framework.\n\n**Documentation**: http://packages.python.org/compare\n\n**Project source**: https://github.com/rudylattae/compare\n\n**PyPI page**: http://pypi.python.org/pypi/compare\n\n\nFeatures\n--------\n\n- provides a base set of matchers for comparing values\n- easy to extend with custom matchers\n- packaged as a single drop-in module\n\n\nRequirements\n------------\n\nThe core implementation of compare is a single file module with no \nadditional requirements beyond the `Python Standard Library`_.\n\n\nInstallation\n------------\n\nThe simplest and recommended way to install compare is with Pip. You may install \nthe latest stable release from PyPI with pip::\n\n > pip install compare\n\nIf you do not have pip, you may use easy_install::\n\n > easy_install compare\n\nAlternatively, you may download the source package from the `compare page on PyPI`_, \nextract it and install it using::\n\n > python setup.py install\n\nIf you wish, you may grab the in development (cutting-edge but unstable) \nversion `compare.py`_ from the project repository and put it into your project directory.\n\n\nWhat you get\n------------\n\nWhen you install the package, you get the **\"expect\"** starter, a simple \nfunction that allows you to compare two values and fail if the outcome does \nnot meet your expectation. This starter has extensible matchers that \nenable you to describe the expected outcome in a pythonic BDD manner. \n\nCompare shines brightest when you are crafting executable specifications \nfor your software. It helps you maintain your flow of thought without succumbing to \ntest-focused non-pythonic distrations like \"self.assertEqual(s)...\", \n\"self.assertTrue\", etc.\n\nHere is a trivial example of the readability you gain when you \nemploy the \"expect\" construct in your specs.\n\n`> cat hello.py`::\n\n greeting = 'Hello you'\n\n`> cat hello_specs.py`::\n\n from compare import expect\n import hello\n \n expect(hello.greeting).to_equal('Hello you')\n\nIf you define an expectation that is not met, you will get an \"Unmet Expectation\" error \nwhich inherits from the python AssertionError so it is compatible with the usual unittest \ntools. Here is an example of such an error::\n\n >>> from compare import expect\n >>> opts = ['foo', 'bar', 'baz']\n >>> expect(opts).to_contain('BAT')\n Traceback (most recent call last):\n ...\n UnmetExpectation: Expected ['foo', 'bar', 'baz'] to contain 'BAT'\n\n\nWhat's missing\n--------------\n\nThe `expect` syntax does not yet have a clean way to negate a matcher. This feature is \nplanned for the next release. An example of the anticipated usage::\n\n expect(['a', 'c', 'd']).NOT.to_contain('b')\n\nThe `to_return` matcher does not accept any parameters to pass to the callable.\n\nMatchers do not accept custom fail messages.\n\n\nFeedback\n--------\n\nI welcome any questions or feedback about bugs and suggestions on how to \nimprove compare. Let me know what you think about compare. I am on twitter \n`@RudyLattae `_ . I appreciate constructive \ncriticsms or high fives :)\n\nDo you have suggestions for improvement? Then please `create an issue`_ with details \nof what you would like to see. I'll take a look at it and work with you to either kill \nthe idea or implement it.\n\n\n=========\nChangelog\n=========\n\n\n0.2b -- 2011-02-11\n==================\n\n* First public beta release\n* Added base matchers: to_be_less_than, to_be_less_than_or_equal_to, to_be_greater_than, to_be_greater_than_or_equal_to, to_be_none, to_be_truthy, to_be_falsy, to_raise\n* Added \"rich comparison\" matchers: ==, <, <=, >, >=\n* Documentation: Core API + Simple user guide.\n\n\n0.1a -- 2011-02-01\n==================\n\n* First public alpha release", "description_content_type": null, "docs_url": "https://pythonhosted.org/compare/", "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/rudylattae/compare", "keywords": "python,compare,matcher,to be,to equal,assert,test equality,specification,BDD,TDD", "license": "Simplified BSD", "maintainer": null, "maintainer_email": null, "name": "compare", "package_url": "https://pypi.org/project/compare/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/compare/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/rudylattae/compare" }, "release_url": "https://pypi.org/project/compare/0.2b/", "requires_dist": null, "requires_python": null, "summary": "Alternative syntax for comparing/asserting expressions in Python. Supports pluggable matchers for custom comparisons.", "version": "0.2b" }, "last_serial": 788335, "releases": { "0.2b": [ { "comment_text": "", "digests": { "md5": "784a6ea7f682d38a8e853a88a2f2374b", "sha256": "e1e518b3b6667d4a77a7f94dc8cc91522c03715462a62ca39490fbf0ea0bf224" }, "downloads": -1, "filename": "compare-0.2b.zip", "has_sig": false, "md5_digest": "784a6ea7f682d38a8e853a88a2f2374b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25273, "upload_time": "2011-02-12T05:55:59", "url": "https://files.pythonhosted.org/packages/92/37/5b57c6d0d14a129b5329d7d800a245d5352f4e4535f5dbd54b123584c6f2/compare-0.2b.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "784a6ea7f682d38a8e853a88a2f2374b", "sha256": "e1e518b3b6667d4a77a7f94dc8cc91522c03715462a62ca39490fbf0ea0bf224" }, "downloads": -1, "filename": "compare-0.2b.zip", "has_sig": false, "md5_digest": "784a6ea7f682d38a8e853a88a2f2374b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25273, "upload_time": "2011-02-12T05:55:59", "url": "https://files.pythonhosted.org/packages/92/37/5b57c6d0d14a129b5329d7d800a245d5352f4e4535f5dbd54b123584c6f2/compare-0.2b.zip" } ] }