summaryrefslogtreecommitdiff
path: root/tests/util.py
diff options
context:
space:
mode:
authorRobert Lehmann <mail@robertlehmann.de>2015-09-11 09:35:46 +0200
committerRobert Lehmann <mail@robertlehmann.de>2015-09-11 09:51:14 +0200
commit8b00f57f4d2ba427a2a320b5b31493c7fe73ad73 (patch)
treea939fe331f96e668bf755a8607d324f9b5b5ef39 /tests/util.py
parenta22fb0d45f04903b9248044fb01c9d19c211cd58 (diff)
downloadsphinx-git-8b00f57f4d2ba427a2a320b5b31493c7fe73ad73.tar.gz
Fixed #1786: Add configurable type hints.
This adds the option of giving, in addition to the type of the default value, hints about permissible types for configuration values.
Diffstat (limited to 'tests/util.py')
-rw-r--r--tests/util.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/util.py b/tests/util.py
index df952d457..246b3728e 100644
--- a/tests/util.py
+++ b/tests/util.py
@@ -94,14 +94,15 @@ def assert_startswith(thing, prefix):
assert False, '%r does not start with %r' % (thing, prefix)
-def assert_in(x, thing):
- if x not in thing:
- assert False, '%r is not in %r' % (x, thing)
-
-
-def assert_not_in(x, thing):
- if x in thing:
- assert False, '%r is in %r' % (x, thing)
+try:
+ from nose.tools import assert_in, assert_not_in
+except ImportError:
+ def assert_in(x, thing, msg=''):
+ if x not in thing:
+ assert False, msg or '%r is not in %r%r' % (x, thing)
+ def assert_not_in(x, thing, msg=''):
+ if x in thing:
+ assert False, msg or '%r is in %r%r' % (x, thing)
def skip_if(condition, msg=None):