-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparams.json
More file actions
1 lines (1 loc) · 4.52 KB
/
params.json
File metadata and controls
1 lines (1 loc) · 4.52 KB
1
{"body":"# PyInq\r\n\r\nPyInq is a Python unit testing framework created in the tradition of the xUnit family. Specifically, it draws its influence from JUnit and PyUnit (unittest).\r\n\r\nThe bulk of PyInq's functionality was influenced by PyUnit. However, Java coders will recogize the use of decorators for test identification from JUnit 4. Selenium users will recogize PyInq's suite of \"eval\" functions; they were influenced by Selenium's \"verify\" functions.\r\n\r\n## Differences From PyUnit (unittest)\r\n* Test identification by decorators\r\n* Module level tests\r\n* Simplified suite creation and execution\r\n * No calling or invoking a test runner\r\n * Create suites with a single keyword argument, not a separate object\r\n* Eval functions\r\n* Detailed, color coded output\r\n * For each test, prints the result of each assert and eval statement\r\n * Color coded based on result\r\n* Pythonic naming\r\n\r\n## Other Notable Features\r\n* Test fixtures\r\n * At test, class, module, and suite level\r\n* Expected exceptions\r\n* Conditional skips\r\n* Output to command line (CLI) or an HTML file\r\n * CLI defaults to color output in Windows console and Linux bash\r\n * CLI defaults to black and white in any other system\r\n* Command line test module/suite execution\r\n\r\n## Coming soon\r\n* Test discovery\r\n* Context manager for assertRaises\r\n* Command-line single test case/class execution\r\n* Multi-suite tests\r\n* Custom printer modules\r\n* Python 3 support\r\n\r\n## Documentation\r\nI have not yet had the chance to write up much documentation. It's high on my TODO list as undocumented projects can be aggrevating to work with. I intend to produce a basic guide to using PyInq, as well as code comments and docstrings.\r\n\r\nFor now, there is basic documentation in the download. In the docs folder, there is a file called \"reference.txt\". This assumes knowledge of unit test frameworks, and serves as a basic reference for what PyInq includes, and how to use it. The other is a directory called examples, which contains a number of tests that exercise various aspects of PyInq. I've tried to name them in a straightforward manner to enable them to giude your usage of this package.\r\n\r\n## Basic Examples\r\nSimply run the code as is to try any of these examples for youself\r\n\r\nA single module level test:\r\n\r\n```python\r\nfrom pyinq.asserts import *\r\nfrom pyinq.tags import *\r\n\t\r\n@test\r\ndef atest():\r\n\tassert_true(True)\r\n```\r\n\r\nTest expecting an error:\r\n\r\n```python\r\nfrom pyinq.asserts import *\r\nfrom pyinq.tags import *\r\n\t\r\n@test(expected=ValueError)\r\ndef tester():\r\n\tassert_equal(int(\"4.0\"),4)\r\n```\r\n\r\nUsing an instance variable::\r\n\r\n```python\r\nfrom pyinq.asserts import *\r\nfrom pyinq.tags import *\r\n\r\n@testClass\r\nclass Class1:\r\n\t@before\r\n\tdef setup():\r\n\t\tthis.num = 4\r\n\t\r\n\t@test\r\n\tdef test():\r\n\t\tassert_equal(this.num,4)\r\n\t\tthis.num += 1\r\n\t\r\n\t@after\r\n\tdef teardown():\r\n\t\tassert_equal(this.num,5)\r\n```\r\n\r\nunittest basic example::\r\n\r\n```python\r\nfrom pyinq.asserts import *\r\nfrom pyinq.tags import *\r\nimport random\r\n\r\n@testClass\r\nclass TestSequenceFunctions:\r\n\t@before\r\n\tdef setUp():\r\n\t\tthis.seq = range(10)\r\n\r\n\t@test\r\n\tdef test_shuffle():\r\n\t\t# make sure the shuffled TestSequenceFunctions.sequence does not lose any elements\r\n\t\trandom.shuffle(this.seq)\r\n\t\tthis.seq.sort()\r\n\t\tassert_equal(this.seq, range(10))\r\n\r\n\t\t# should raise an exception for an immutable TestSequenceFunctions.sequence\r\n\t\tassert_raises(TypeError, random.shuffle, (1,2,3))\r\n\r\n\t@test\r\n\tdef test_choice():\r\n\t\telement = random.choice(this.seq)\r\n\t\tassert_true(element in this.seq)\r\n\r\n\t@test\r\n\tdef test_sample():\r\n\t\tassert_raises(ValueError, random.sample, this.seq, 20)\r\n\t\tfor element in random.sample(this.seq, 5):\r\n\t\t\tassert_in(element,this.seq)\r\n```\r\n\r\n## Contact Me\r\nIf you have any questions or comments, find any bugs, or wish to make any feature requests, shoot me an email at <pyinq.test@gmail.com>. I am especially hoping to receive bug reports, for although I am unaware of any bugs, fresh sets of eyes have a better chance of finding what I missed.\r\n\r\nAlso, I will be setting up a separate web page and public GitHub repo for this project very soon. I will post those links here once they are ready.","tagline":"An alternative Python unit test framework","note":"Don't delete this file! It's used internally to help with page regeneration.","name":"Pyinq","google":""}