summaryrefslogtreecommitdiff
path: root/tests/test_testing.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2013-12-14 13:46:49 -0500
committerNed Batchelder <ned@nedbatchelder.com>2013-12-14 13:46:49 -0500
commit6954fd99ff252c3f778680f380053989ed1c06ad (patch)
tree050ae3f2aa6a9b34b91ab1e282379cd9d698bfd8 /tests/test_testing.py
parent4ed85677ffbde1d5bfcac8d3e6850a25374a5331 (diff)
downloadpython-coveragepy-6954fd99ff252c3f778680f380053989ed1c06ad.tar.gz
Add assert_starts_with
Diffstat (limited to 'tests/test_testing.py')
-rw-r--r--tests/test_testing.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_testing.py b/tests/test_testing.py
index 64dca61..6222db9 100644
--- a/tests/test_testing.py
+++ b/tests/test_testing.py
@@ -166,6 +166,17 @@ class CoverageTestTest(CoverageTest):
)
self.assertRaises(AssertionError, self.assert_exists, "shadow.txt")
+ def test_assert_startwith(self):
+ self.assert_starts_with("xyzzy", "xy")
+ self.assert_starts_with("xyz\nabc", "xy")
+ self.assert_starts_with("xyzzy", ("x", "z"))
+ self.assertRaises(
+ AssertionError, self.assert_starts_with, "xyz", "a"
+ )
+ self.assertRaises(
+ AssertionError, self.assert_starts_with, "xyz\nabc", "a"
+ )
+
def test_sub_python_is_this_python(self):
# Try it with a python command.
os.environ['COV_FOOBAR'] = 'XYZZY'