summaryrefslogtreecommitdiff
path: root/tests/string_asserts.py
diff options
context:
space:
mode:
authorGaurav Jain <gaurav@gauravjain.org>2014-05-17 10:06:29 -0400
committerGaurav Jain <gaurav@gauravjain.org>2014-05-17 10:06:29 -0400
commitb4328f0a0cd095ce34eb4614cfd3267d695ddf8f (patch)
tree6af6ad8b23f89c47746c280f7e2bf8cbefcd4ce6 /tests/string_asserts.py
parent16cc059837eb83f96f35caf207c1e0778673f63c (diff)
parent778edd1d5ff974b1d4084af964151d9f87f05efd (diff)
downloadpygments-b4328f0a0cd095ce34eb4614cfd3267d695ddf8f.tar.gz
Merged birkenfeld/pygments-main into default
Diffstat (limited to 'tests/string_asserts.py')
-rw-r--r--tests/string_asserts.py22
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))