diff --git a/testimony/config.py b/testimony/config.py index f3234cc..fde1a4a 100644 --- a/testimony/config.py +++ b/testimony/config.py @@ -13,7 +13,8 @@ - Automated ... -Currently only supported type is 'choice', but in the future more can be added. +Currently only supported types are 'choice' and 'string' +but in the future more can be added. """ import yaml @@ -79,6 +80,9 @@ def __init__(self, name, config): self.choices = [i if self.casesensitive else i.lower() for i in config['choices']] + elif self.token_type == 'string': + pass + def update(self, new_values): """Update token configuration with dictionary of new values.""" for key, value in new_values.items(): @@ -90,4 +94,6 @@ def validate(self, what): if not self.casesensitive: what = what.lower() return what in self.choices + elif self.token_type == 'string': + return isinstance(what, str) # validate it's a string return True # assume valid for unknown types diff --git a/testimony/constants.py b/testimony/constants.py index 1cf54eb..e5d69fc 100644 --- a/testimony/constants.py +++ b/testimony/constants.py @@ -18,6 +18,7 @@ TOKEN_TYPES = [ 'choice', + 'string' ] DEFAULT_TOKENS = (