~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/testing/__init__.py

  • Committer: Francis J. Lacoste
  • Date: 2011-07-07 20:55:58 UTC
  • mto: This revision was merged to the branch mainline in revision 13501.
  • Revision ID: francis.lacoste@canonical.com-20110707205558-4g1zsjqi12mi1ey2
Added assertEndsWith, assertStartsWith.

Show diffs side-by-side

added added

removed removed

Lines of Context:
618
618
            self._unfoldEmailHeader(expected),
619
619
            self._unfoldEmailHeader(observed))
620
620
 
 
621
    def assertStartsWith(self, s, prefix):
 
622
        if not s.startswith(prefix):
 
623
            raise AssertionError(
 
624
                'string %r does not start with %r' % (s, prefix))
 
625
 
 
626
    def assertEndsWith(self, s, suffix):
 
627
        """Asserts that s ends with suffix."""
 
628
        if not s.endswith(suffix):
 
629
            raise AssertionError(
 
630
                'string %r does not end with %r' % (s, suffix))
 
631
 
621
632
 
622
633
class TestCaseWithFactory(TestCase):
623
634