From ebda4b8697aea093fb9e16fa383affe41dfa8811 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 14 Dec 2013 13:46:49 -0500 Subject: Add assert_starts_with --- tests/test_testing.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/test_testing.py') diff --git a/tests/test_testing.py b/tests/test_testing.py index 64dca617..6222db9a 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' -- cgit v1.2.1