mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
UID replacement benchmark
This commit is contained in:
parent
e3060529a5
commit
56fe38fcdc
1 changed files with 52 additions and 41 deletions
|
|
@ -161,8 +161,7 @@ def test_multiline_uid(benchmark):
|
||||||
assert benchmark(lambda: vobject.Item(a).uid) == u'123456789abcdefgh'
|
assert benchmark(lambda: vobject.Item(a).uid) == u'123456789abcdefgh'
|
||||||
|
|
||||||
|
|
||||||
def test_multiline_uid_complex():
|
complex_uid_item = dedent(u'''
|
||||||
a = dedent(u'''
|
|
||||||
BEGIN:VCALENDAR
|
BEGIN:VCALENDAR
|
||||||
BEGIN:VTIMEZONE
|
BEGIN:VTIMEZONE
|
||||||
TZID:Europe/Rome
|
TZID:Europe/Rome
|
||||||
|
|
@ -199,9 +198,21 @@ def test_multiline_uid_complex():
|
||||||
END:VEVENT
|
END:VEVENT
|
||||||
END:VCALENDAR
|
END:VCALENDAR
|
||||||
''').strip()
|
''').strip()
|
||||||
assert vobject.Item(a).uid == (u'040000008200E00074C5B7101A82E008000000005'
|
|
||||||
|
|
||||||
|
def test_multiline_uid_complex(benchmark):
|
||||||
|
assert benchmark(lambda: vobject.Item(complex_uid_item).uid) == (
|
||||||
|
u'040000008200E00074C5B7101A82E008000000005'
|
||||||
u'0AAABEEF50DCF001000000062548482FA830A46B9'
|
u'0AAABEEF50DCF001000000062548482FA830A46B9'
|
||||||
u'EA62114AC9F0EF')
|
u'EA62114AC9F0EF'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_replace_multiline_uid(benchmark):
|
||||||
|
def inner():
|
||||||
|
return vobject.Item(complex_uid_item).with_uid('a').uid
|
||||||
|
|
||||||
|
assert benchmark(inner) == 'a'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('template', [EVENT_TEMPLATE,
|
@pytest.mark.parametrize('template', [EVENT_TEMPLATE,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue