mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Fix unused formatting string
This commit is contained in:
parent
82f47737a0
commit
b1ec9c26c7
2 changed files with 30 additions and 3 deletions
|
|
@ -1,6 +1,9 @@
|
||||||
import os
|
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
|
from vdirsyncer.vobject import Item
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -22,3 +25,26 @@ def test_conflict_resolution_command():
|
||||||
a, b, ['~/command'], 'a', 'b',
|
a, b, ['~/command'], 'a', 'b',
|
||||||
_check_call=check_call
|
_check_call=check_call
|
||||||
).raw == a.raw
|
).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)
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,9 @@ def _validate_collections_param(collections):
|
||||||
elif isinstance(collection, list):
|
elif isinstance(collection, list):
|
||||||
e = ValueError(
|
e = ValueError(
|
||||||
'Expected list of format '
|
'Expected list of format '
|
||||||
'["config_name", "storage_a_name", "storage_b_name"]'
|
'["config_name", "storage_a_name", "storage_b_name"], but '
|
||||||
.format(len(collection)))
|
'found {!r} instead.'
|
||||||
|
.format(collection))
|
||||||
if len(collection) != 3:
|
if len(collection) != 3:
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue