diff options
author | Tim Hatch <tim@timhatch.com> | 2014-05-16 17:52:34 -0700 |
---|---|---|
committer | Tim Hatch <tim@timhatch.com> | 2014-05-16 17:52:34 -0700 |
commit | 778edd1d5ff974b1d4084af964151d9f87f05efd (patch) | |
tree | e92c418a1396733ee5fd92b4ece42314b47be431 /tests/string_asserts.py | |
parent | 97422c5ed7200eeb588cf07f3e63cd1a80016f15 (diff) | |
parent | 6a2d5f2126349eefac049953a410ffa8f3458c05 (diff) | |
download | pygments-778edd1d5ff974b1d4084af964151d9f87f05efd.tar.gz |
Merged in jambonrose/pygments-main (pull request #338)
Produce only unicode escape sequences in RTFs
Diffstat (limited to 'tests/string_asserts.py')
-rw-r--r-- | tests/string_asserts.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/string_asserts.py b/tests/string_asserts.py new file mode 100644 index 00000000..025a5281 --- /dev/null +++ b/tests/string_asserts.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +""" + Pygments string assert utility + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +class StringTests(object): + + def assertStartsWith(self, haystack, needle, msg=None): + if msg is None: + msg = "'{}' does not start with '{}'".format(haystack, needle) + if not haystack.startswith(needle): + raise(AssertionError(msg)) + + def assertEndsWith(self, haystack, needle, msg=None): + if msg is None: + msg = "'{}' does not end with '{}'".format(haystack, needle) + if not haystack.endswith(needle): + raise(AssertionError(msg)) |