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.
This commit is contained in:
Robert Lehmann
2015-09-11 09:35:46 +02:00
parent a22fb0d45f
commit 8b00f57f4d
5 changed files with 116 additions and 83 deletions

View File

@@ -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):