summaryrefslogtreecommitdiff
path: root/test/test_testing.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-10-25 09:31:20 -0400
committerNed Batchelder <ned@nedbatchelder.com>2009-10-25 09:31:20 -0400
commitffb82b1d4ce8553ac230d3ecabbf094c4c20d140 (patch)
treec63363d35149c15590604f051c9c332eed707d9b /test/test_testing.py
parent02e3d4392b25b8c3fff9e7a00c86665d26fe1ba9 (diff)
downloadpython-coveragepy-git-ffb82b1d4ce8553ac230d3ecabbf094c4c20d140.tar.gz
Add an assert_matches method, and tests to prove it works.
Diffstat (limited to 'test/test_testing.py')
-rw-r--r--test/test_testing.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/test_testing.py b/test/test_testing.py
new file mode 100644
index 00000000..806f087e
--- /dev/null
+++ b/test/test_testing.py
@@ -0,0 +1,26 @@
+"""Tests that our test infrastructure is really working!"""
+
+import os, sys
+sys.path.insert(0, os.path.split(__file__)[0]) # Force relative import for Py3k
+from coveragetest import CoverageTest
+
+class TestingTest(CoverageTest):
+ """Tests of helper methods on CoverageTest."""
+
+ def test_assert_equal_sets(self):
+ self.assert_equal_sets(set(), set())
+ self.assert_equal_sets(set([1,2,3]), set([3,1,2]))
+ self.assertRaises(AssertionError, self.assert_equal_sets,
+ set([1,2,3]), set()
+ )
+ self.assertRaises(AssertionError, self.assert_equal_sets,
+ set([1,2,3]), set([4,5,6])
+ )
+
+ def test_assert_matches(self):
+ self.assert_matches("hello", "hel*o")
+ self.assert_matches("Oh, hello there!", "hel*o")
+ self.assertRaises(AssertionError, self.assert_matches,
+ "hello there", "^hello$"
+ )
+