A collection of test helpers, additional assertions, and the like.
Project description
This package collects various helpers for writing tests.
assertEllipsis
An assertion which is very helpful when using Testbrowser with unittest.TestCase (instead of doctests).
Some examples:
class MyTest(unittest.TestCase, gocept.testing.assertion.Ellipsis): # [...] self.assertEllipsis('...bar...', 'foo bar qux') # -> nothing happens self.assertEllipsis('foo', 'bar') # -> AssertionError: Differences (ndiff with -expected +actual): - foo + bar self.assertNotEllipsis('foo', 'foo') # -> AssertionError: "Value unexpectedly matches expression 'foo'."
To use, inherit from gocept.testing.assertion.Ellipsis in addition to unittest.TestCase.
assertNothingRaised
The opposite of assertRaises(), this is an assertion that makes some tests more readable. As assertRaises(), it can be used as as context manager, too:
class MyTest(unittest.TestCase, gocept.testing.assertion.Exceptions): # [...] self.assertNothingRaised(do_something, 1, 2, 3) with self.assertNothingRaised(): do_something(1, 2, 3)
Development
The source code is available in the mercurial repository at https://code.gocept.com/hg/public/gocept.testing
Please report any bugs you find at https://projects.gocept.com/projects/projects/gocept-testing/issues
Changelog
1.1 (2011-11-10)
Add assertNothingRaised.
1.0 (2011-11-02)
first release.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.