summaryrefslogtreecommitdiff
path: root/test/test_testing.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2012-11-09 07:19:56 -0500
committerNed Batchelder <ned@nedbatchelder.com>2012-11-09 07:19:56 -0500
commit429868d515cc4ea74d625715512c57d3b5b93e73 (patch)
tree539e1e71c681d7721a0441e3108847129cb5a1f4 /test/test_testing.py
parentc260721a7bbe8d75368fc35daa719655217a83f2 (diff)
downloadpython-coveragepy-git-429868d515cc4ea74d625715512c57d3b5b93e73.tar.gz
Add assertIn for test use.
Diffstat (limited to 'test/test_testing.py')
-rw-r--r--test/test_testing.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test_testing.py b/test/test_testing.py
index 316dbc1b..c632f3b5 100644
--- a/test/test_testing.py
+++ b/test/test_testing.py
@@ -92,6 +92,14 @@ class TestingTest(TestCase):
self.assertFalse(False)
self.assertRaises(AssertionError, self.assertFalse, True)
+ def test_assert_contains(self):
+ self.assertIn("abc", "hello abc")
+ self.assertIn("abc", ["xyz", "abc", "foo"])
+ self.assertIn("abc", {'abc': 1, 'xyz': 2})
+ self.assertRaises(AssertionError, self.assertIn, "abc", "xyz")
+ self.assertRaises(AssertionError, self.assertIn, "abc", ["x", "xabc"])
+ self.assertRaises(AssertionError, self.assertIn, "abc", {'x':'abc'})
+
class CoverageTestTest(CoverageTest):
"""Test the methods in `CoverageTest`."""