Fix unused formatting string

This commit is contained in:
Markus Unterwaditzer 2018-01-22 01:00:25 +01:00
parent 82f47737a0
commit b1ec9c26c7
2 changed files with 30 additions and 3 deletions

View file

@ -1,6 +1,9 @@
import os
import pytest
from io import StringIO
from textwrap import dedent
from vdirsyncer.cli.config import _resolve_conflict_via_command
from vdirsyncer.cli.config import Config, _resolve_conflict_via_command
from vdirsyncer.vobject import Item
@ -22,3 +25,26 @@ def test_conflict_resolution_command():
a, b, ['~/command'], 'a', 'b',
_check_call=check_call
).raw == a.raw
def test_config_reader_invalid_collections():
s = StringIO(dedent('''
[general]
status_path = "foo"
[storage foo]
type = "memory"
[storage bar]
type = "memory"
[pair foobar]
a = "foo"
b = "bar"
collections = [["a", "b", "c", "d"]]
''').strip())
with pytest.raises(ValueError) as excinfo:
Config.from_fileobject(s)
assert 'Expected list of format' in str(excinfo.value)

View file

@ -63,8 +63,9 @@ def _validate_collections_param(collections):
elif isinstance(collection, list):
e = ValueError(
'Expected list of format '
'["config_name", "storage_a_name", "storage_b_name"]'
.format(len(collection)))
'["config_name", "storage_a_name", "storage_b_name"], but '
'found {!r} instead.'
.format(collection))
if len(collection) != 3:
raise e