{ "info": { "author": "Jim Fulton", "author_email": "jim@jimfulton.info", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "===================================================\ntestvars - Place-holders in complex test assertions\n===================================================\n\nSometimes, when writing tests, you want to assert that a data\nstructure computed in a test matches some expected value, but the\nexpected value might have components, such as times or generated ids\nthat can't be predicted ahead of time. Options in this situation\ninclude:\n\n- break the assertion into many assertions about various parts of the\n data structure.\n\n- Use mocking/stubbing to control things like time and ids to make\n unpredictable parts of the data predictable.\n\nBoth of these approaches tend to be pretty tedious and potentially\nerror prone.\n\nThe tiny testvars package provides an alternative that is much easier\nto use in many cases. The package provides a ``Vars`` class::\n\n >>> import testvars\n >>> vars = testvars.Vars()\n\nWhen ``Vars`` attributes are compared equal the first time, the\ncomparison succeeds and alse sets their value:\n\n >>> vars.x == 1\n True\n\nAt that point, the value is set, and you can make assertions\nagainst it:\n\n >>> vars.x\n 1\n >>> vars.x > 0\n True\n\nFurther comparisons are against this set value:\n\n >>> vars.x == 2\n False\n\nThis is useful when dealing with data structures with unpredictable\nparts:\n\n >>> expected = {'id': vars.child_id, 'name':\"Alex\"}\n >>> {'id': 32, 'name':\"Alex\"} == expected\n True\n\nIt's also interesting when, while you don't know what values will be,\nyou can make assertions about how values are related:\n\n >>> expected = {'id': vars.parent_id, 'name':'Cas',\n ... 'children': [vars.child_id]}\n >>> expected == {'id': 42, 'name':'Cas', 'children':[32]}\n True\n >>> expected == {'id': 42, 'name':'Cas', 'children':[33]}\n False\n\n >>> [vars.y, 2, 3, vars.y] == [9, 2, 3, 9]\n True\n\n >>> [vars.z, 2, 3, vars.z] == [8, 2, 3, 9]\n False\n\n=======\nChanges\n=======\n\n1.0.0 (2017-07-07)\n==================\n\nInitial release", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jimfulton/testvars", "keywords": "test,testing", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "testvars", "package_url": "https://pypi.org/project/testvars/", "platform": "", "project_url": "https://pypi.org/project/testvars/", "project_urls": { "Homepage": "https://github.com/jimfulton/testvars" }, "release_url": "https://pypi.org/project/testvars/1.0.0/", "requires_dist": null, "requires_python": "", "summary": "testvars - Place-holders in complex test assertions", "version": "1.0.0" }, "last_serial": 3006317, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "275329b37a2b6a59223225b0dfcf9921", "sha256": "ce3c6bfae70b7be4f96a6b659958a242ac1fa7ac079d97b27693f31591da868e" }, "downloads": -1, "filename": "testvars-1.0.0.tar.gz", "has_sig": false, "md5_digest": "275329b37a2b6a59223225b0dfcf9921", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3468, "upload_time": "2017-07-07T14:38:00", "url": "https://files.pythonhosted.org/packages/ee/ba/8d21aa805bdb7ae8801a0debba66af0dab741a35521bbffefa0b5a635542/testvars-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "275329b37a2b6a59223225b0dfcf9921", "sha256": "ce3c6bfae70b7be4f96a6b659958a242ac1fa7ac079d97b27693f31591da868e" }, "downloads": -1, "filename": "testvars-1.0.0.tar.gz", "has_sig": false, "md5_digest": "275329b37a2b6a59223225b0dfcf9921", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3468, "upload_time": "2017-07-07T14:38:00", "url": "https://files.pythonhosted.org/packages/ee/ba/8d21aa805bdb7ae8801a0debba66af0dab741a35521bbffefa0b5a635542/testvars-1.0.0.tar.gz" } ] }