mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +00:00
Fix typo induced bug in split_collection
This commit is contained in:
parent
2cc375aee6
commit
96aae16c32
2 changed files with 17 additions and 1 deletions
|
|
@ -7,6 +7,8 @@
|
|||
:license: MIT, see LICENSE for more details.
|
||||
'''
|
||||
|
||||
import pytest
|
||||
|
||||
import vdirsyncer.utils.vobject as vobject
|
||||
|
||||
from .. import BARE_EVENT_TEMPLATE, EVENT_TEMPLATE, VCARD_TEMPLATE, \
|
||||
|
|
@ -52,6 +54,20 @@ def test_split_collection_multiple_wrappers():
|
|||
assert [x.splitlines() for x in given] == \
|
||||
[x.splitlines() for x in _simple_split]
|
||||
|
||||
def test_split_collection_different_wrappers():
|
||||
with pytest.raises(ValueError) as exc_info:
|
||||
list(vobject.split_collection(u'BEGIN:VADDRESSBOOK\r\n'
|
||||
u'BEGIN:FOO\r\n'
|
||||
u'END:FOO\r\n'
|
||||
u'END:VADDRESSBOOK\r\n'
|
||||
u'BEGIN:VCALENDAR\r\n'
|
||||
u'BEGIN:FOO\r\n'
|
||||
u'END:FOO\r\n'
|
||||
u'END:VCALENDAR\r\n'))
|
||||
|
||||
assert 'different types of components at top-level' in \
|
||||
str(exc_info.value).lower()
|
||||
|
||||
|
||||
def test_join_collection_simple():
|
||||
given = vobject.join_collection(_simple_split)
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ def split_collection(text, inline=(u'VTIMEZONE',),
|
|||
else:
|
||||
start = end = u''
|
||||
|
||||
if collection.name != collection.name:
|
||||
if collection.name != collection_name:
|
||||
raise ValueError('Different types of components at top-level. '
|
||||
'Expected {}, got {}.'
|
||||
.format(collection_name, collection.name))
|
||||
|
|
|
|||
Loading…
Reference in a new issue