{ "info": { "author": "Kirill Ermolov", "author_email": "erm0l0v@ya.ru", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Software Development", "Topic :: Software Development :: Testing" ], "description": "===============================\nPython wrap cases\n===============================\n\n.. image:: https://badges.gitter.im/Join%20Chat.svg\n :alt: Join the chat at https://gitter.im/erm0l0v/python_wrap_cases\n :target: https://gitter.im/erm0l0v/python_wrap_cases?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge\n\n.. image:: https://img.shields.io/travis/erm0l0v/python_wrap_cases.svg\n :target: https://travis-ci.org/erm0l0v/python_wrap_cases\n\n.. image:: https://img.shields.io/pypi/v/python_wrap_cases.svg\n :target: https://pypi.python.org/pypi/python_wrap_cases\n\n.. image:: https://readthedocs.org/projects/python-wrap-cases/badge/?version=latest\n :target: https://readthedocs.org/projects/python-wrap-cases/?badge=latest\n :alt: Documentation Status\n\n\nSimple library for generate test cases with parameters.\n\nWhat is this?\n-------------\n\nThis library helps to generate tests with parameters.\n\nLet's write some tests for this function:\n\n.. code:: python\n\n import re\n \n \n def clear_start_end_dash(string):\n return re.sub(r'^[\\s\\-]*-|-[\\s\\-]*$', '', string)\n\n\nWe may write something like this:\n\n.. code:: python\n\n from unittest import TestCase\n \n \n class ClearStartEndDashTest(TestCase):\n\n def test_remove_first_dash(self):\n result = clear_start_end_dash('-my string')\n self.assertEqual(result, 'my string')\n\n def test_remove_all_first_dashes(self):\n result = clear_start_end_dash('- -- --my string')\n self.assertEqual(result, 'my string')\n\n def test_remove_last_dash(self):\n result = clear_start_end_dash('my string-')\n self.assertEqual(result, 'my string')\n\n def test_remove_all_last_dashes(self):\n result = clear_start_end_dash('my string-- -- -- - ')\n self.assertEqual(result, 'my string')\n\n def test_keep_dash_at_center(self):\n result = clear_start_end_dash('my-string')\n self.assertEqual(result, 'my-string')\n\n\nIt's good, but we spent a lot of time to write those absolutely the same test functions.\n\nSo let's decrease the number of duplicate functions:\n\n.. code:: python\n\n from unittest import TestCase\n \n \n class ClearStartEndDashDryTest(TestCase):\n\n def test_remove_dash(self):\n cases = (\n ('-my string', 'my string'),\n ('- -- --my string', 'my string'),\n ('my string-', 'my string'),\n ('my string-- -- -- - ', 'my string'),\n ('my-string', 'my-string')\n )\n for string, expected_result in cases:\n result = clear_start_end_dash(string)\n self.assertEqual(result, expected_result)\n\n\nThis code has a few problems:\n\n* Easy to write but difficult to read.\n* We can't use test fixture (`setUp`, `tearDown`) with each case.\n* If some case fails, the other cases won't run.\n* If test `test_remove_dash` fails, it won't help us find out what happened.\n\nLook how easy we may solve these problems using this library:\n\n.. code:: python\n\n from unittest import TestCase\n from python_wrap_cases import wrap_case\n \n \n @wrap_case\n class ClearStartEndDashWrapTest(TestCase):\n\n @wrap_case('-my string', 'my string')\n @wrap_case('- -- --my string', 'my string')\n @wrap_case('my string-', 'my string')\n @wrap_case('my string-- -- -- - ', 'my string')\n @wrap_case('my-string', 'my-string')\n def test_remove_dash(self, string, expected_result):\n result = clear_start_end_dash(string)\n self.assertEqual(result, expected_result)\n\n\nThis code generates 5 tests, that works like a simple test functions.\n\nConsole output:\n\n.. code::\n\n test_remove_dash_u'- -- --my string'_u'my string' (tests.example.test_simple_test.ClearStartEndDashWrapTest) ... ok\n test_remove_dash_u'-my string'_u'my string' (tests.example.test_simple_test.ClearStartEndDashWrapTest) ... ok\n test_remove_dash_u'my string-'_u'my string' (tests.example.test_simple_test.ClearStartEndDashWrapTest) ... ok\n test_remove_dash_u'my string-- -- -- - '_u'my string' (tests.example.test_simple_test.ClearStartEndDashWrapTest) ... ok\n test_remove_dash_u'my-string'_u'my-string' (tests.example.test_simple_test.ClearStartEndDashWrapTest) ... ok\n\n\nInstallation\n------------\n\n.. code::\n\n pip install python_wrap_cases\n\n\nFree software: BSD license\n\nDocumentation: https://python_wrap_cases.readthedocs.org.\n\n\n\n\nHistory\n-------\n\n0.1.0 (2015-06-26)\n---------------------\n\n* First release on PyPI.\n\n\n0.1.2 (2015-06-26)\n---------------------\n\n* Fix generators import\n\n0.1.3 (2015-06-26)\n---------------------\n\n* Add some docs\n\n0.1.4 (2015-06-29)\n--------------------\n\n* ReadMe add semicolon\n* Fix pypi readme\n\n0.1.5 (2015-07-01)\n--------------------\n\n* README remove ::;\n\n\n0.1.6 (2015-07-01)\n--------------------\n\n* Add tests fot python 3.2\n\n0.1.7 (2015-07-10)\n--------------------\n\n* Add six dependency\n\n0.1.8 (2015-08-21)\n--------------------\n\n* Add func generator\n* Add range generator\n* Fix problem with iterator in custom generator\n* Add new API for declaration wrapped TestCase. (added wrap_case decorator without parameters)", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/erm0l0v/python_wrap_cases", "keywords": "python_wrap_cases,test cases,test,test with parameters,generate tests", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "python_wrap_cases", "package_url": "https://pypi.org/project/python_wrap_cases/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/python_wrap_cases/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/erm0l0v/python_wrap_cases" }, "release_url": "https://pypi.org/project/python_wrap_cases/0.1.8/", "requires_dist": null, "requires_python": null, "summary": "Simple library for generate test cases.", "version": "0.1.8" }, "last_serial": 1687115, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "9c8d80321e82404855386677ae54dd30", "sha256": "f72c693dcec7ae365a1cdf7186b396bad691cdd721001b745a78ff183afc3d98" }, "downloads": -1, "filename": "python_wrap_cases-0.1.2.tar.gz", "has_sig": false, "md5_digest": "9c8d80321e82404855386677ae54dd30", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16203, "upload_time": "2015-06-26T11:15:49", "url": "https://files.pythonhosted.org/packages/2d/1d/e27e8a550f50a67881c271cece83991824f5c073fbb6bf01e1f884deb2d0/python_wrap_cases-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "1596ec100c3caa016ce429b052a38a4e", "sha256": "13b66580914cc6ecf4c7e01ee967b0450033449bf5b276a53592c1e2e651f74f" }, "downloads": -1, "filename": "python_wrap_cases-0.1.3.tar.gz", "has_sig": false, "md5_digest": "1596ec100c3caa016ce429b052a38a4e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17175, "upload_time": "2015-06-26T13:58:05", "url": "https://files.pythonhosted.org/packages/86/c2/4f1813ae20f8fdd2d3465115671550c0dea4d763e77f3dcb8fedd8ab5f79/python_wrap_cases-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "9ea34a3a6fc235768b8fec055f6971fa", "sha256": "207a08fc911d76635d8cc0f0991b4e1ed99c85ccb3ff15aa5b6a497fdc3f5106" }, "downloads": -1, "filename": "python_wrap_cases-0.1.4.tar.gz", "has_sig": false, "md5_digest": "9ea34a3a6fc235768b8fec055f6971fa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17214, "upload_time": "2015-06-29T18:41:38", "url": "https://files.pythonhosted.org/packages/74/84/cb14ab88bc0bd2207ceda1085d9346af7d4ea9c4d02cb8d2f397e5425d9a/python_wrap_cases-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "9d9e1f1a302111bbff2ece0911774af0", "sha256": "2421aa9979582f12b23a36357044d38bf3a15202f7d1cc5b2a0b0ff234d7aad7" }, "downloads": -1, "filename": "python_wrap_cases-0.1.5.tar.gz", "has_sig": false, "md5_digest": "9d9e1f1a302111bbff2ece0911774af0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17258, "upload_time": "2015-07-01T08:12:56", "url": "https://files.pythonhosted.org/packages/9a/36/c0f98520f2838d80297ff4f82e615adc70ee87be4cfbfa945bb93bd7c89c/python_wrap_cases-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "4b3170fe4d7e6ce2dceb5a5a3c6cfef9", "sha256": "f48155697c1f0f695880676fe6e5c844398c0f78fd1856c34fc44ab941cd616f" }, "downloads": -1, "filename": "python_wrap_cases-0.1.6.tar.gz", "has_sig": false, "md5_digest": "4b3170fe4d7e6ce2dceb5a5a3c6cfef9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17330, "upload_time": "2015-07-01T08:58:07", "url": "https://files.pythonhosted.org/packages/74/77/96ca276be468269f412aa703105183bcb55280e1a3122bb79ec000c03d73/python_wrap_cases-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "c22a6abbf4769ee6e300f6ccc4d8d825", "sha256": "68f0f2926ab80eb5dd93f91080e442e43d22c2cc3c100e28136c5d68c7805679" }, "downloads": -1, "filename": "python_wrap_cases-0.1.7.tar.gz", "has_sig": false, "md5_digest": "c22a6abbf4769ee6e300f6ccc4d8d825", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17349, "upload_time": "2015-07-10T13:08:01", "url": "https://files.pythonhosted.org/packages/54/b7/ff97e4cccd3c9ea789cf7932972c8d59d9e7c98d25fafd0b0b957f244385/python_wrap_cases-0.1.7.tar.gz" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "07b044e3b28c6cb7a85fee29195a97e7", "sha256": "924ef09da7934d743440c1de9f76bb530d79f6b4e0af23b3c8c372452c0026c8" }, "downloads": -1, "filename": "python_wrap_cases-0.1.8.tar.gz", "has_sig": false, "md5_digest": "07b044e3b28c6cb7a85fee29195a97e7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20232, "upload_time": "2015-08-21T10:04:43", "url": "https://files.pythonhosted.org/packages/a9/a2/2542622e32244f016e83115677be96344cba9a17dea6461fb7545b6b6956/python_wrap_cases-0.1.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "07b044e3b28c6cb7a85fee29195a97e7", "sha256": "924ef09da7934d743440c1de9f76bb530d79f6b4e0af23b3c8c372452c0026c8" }, "downloads": -1, "filename": "python_wrap_cases-0.1.8.tar.gz", "has_sig": false, "md5_digest": "07b044e3b28c6cb7a85fee29195a97e7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20232, "upload_time": "2015-08-21T10:04:43", "url": "https://files.pythonhosted.org/packages/a9/a2/2542622e32244f016e83115677be96344cba9a17dea6461fb7545b6b6956/python_wrap_cases-0.1.8.tar.gz" } ] }