{ } Raw JSON

bundles / astropy latest / astropy / extern / configobj / validate / is_string

function

astropy.extern.configobj.validate:is_string

source: /astropy/extern/configobj/validate.py :1073

Signature

def   is_string ( value min = None max = None )

Summary

Check that the supplied value is a string.

Extended Summary

You can optionally specify the minimum and maximum number of members.

>>> vtor.check('string', '0')
'0'
>>> vtor.check('string', 0)
Traceback (most recent call last):
VdtTypeError: the value "0" is of the wrong type.
>>> vtor.check('string(2)', '12')
'12'
>>> vtor.check('string(2)', '1')
Traceback (most recent call last):
VdtValueTooShortError: the value "1" is too short.
>>> vtor.check('string(min=2, max=3)', '123')
'123'
>>> vtor.check('string(min=2, max=3)', '1234')
Traceback (most recent call last):
VdtValueTooLongError: the value "1234" is too long.

Aliases

  • astropy.config.configuration.validate.is_string