diff options
-rw-r--r-- | alot/settings/checks.py | 5 | ||||
-rw-r--r-- | tests/settings/__init__.py | 0 | ||||
-rw-r--r-- | tests/settings/checks_test.py | 16 |
3 files changed, 16 insertions, 5 deletions
diff --git a/alot/settings/checks.py b/alot/settings/checks.py index bef91a77..6f909524 100644 --- a/alot/settings/checks.py +++ b/alot/settings/checks.py @@ -121,11 +121,6 @@ def force_list(value, min=None, max=None): The difference to :func:`validate.force_list` is that this test will return an empty list instead of `['']` if the config value matches `r'\s*,?\s*'`. - - >>> vtor.check('force_list', 'hello') - ['hello'] - >>> vtor.check('force_list', '') - [] """ if not isinstance(value, (list, tuple)): value = [value] diff --git a/tests/settings/__init__.py b/tests/settings/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/tests/settings/__init__.py diff --git a/tests/settings/checks_test.py b/tests/settings/checks_test.py new file mode 100644 index 00000000..917e2438 --- /dev/null +++ b/tests/settings/checks_test.py @@ -0,0 +1,16 @@ +# encoding=utf-8 + +import unittest + +from alot.settings import checks + + +class TestForceList(unittest.TestCase): + + def test_strings_are_converted_to_single_item_lists(self): + forced = checks.force_list('hello') + self.assertEqual(forced, ['hello']) + + def test_empty_strings_are_converted_to_empty_lists(self): + forced = checks.force_list('') + self.assertEqual(forced, []) |