Skip to content

Commit

Permalink
Added test cases for #125
Browse files Browse the repository at this point in the history
  • Loading branch information
heuer committed Oct 19, 2023
1 parent 97465e1 commit f97e0d9
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions tests/test_issue_125.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 - 2023 -- Lars Heuer
# All rights reserved.
#
# License: BSD License
#
"""\
Issue <https://github.com/heuer/segno/issues/128>
Don't include blank vcard/mecard fields.
"""
from __future__ import unicode_literals, absolute_import
import pytest
import segno
from segno import helpers


def test_mecard_data():
mecard = helpers.make_mecard_data(name='Mustermann,Max', phone=[])
assert 'MECARD:N:Mustermann,Max;;' == mecard
mecard = helpers.make_mecard_data(name='Mustermann,Max', email="")
assert 'MECARD:N:Mustermann,Max;;' == mecard


def test_vcard_data():
res = 'BEGIN:VCARD\r\n' \
'VERSION:3.0\r\n' \
'N:Mustermann;Max\r\n' \
'FN:Max Mustermann\r\n' \
'END:VCARD\r\n'
vcard = helpers.make_vcard_data('Mustermann;Max', 'Max Mustermann', phone="")
assert res == vcard
vcard = helpers.make_vcard_data('Mustermann;Max', 'Max Mustermann', email="")
assert res == vcard
vcard = helpers.make_vcard_data('Mustermann;Max', 'Max Mustermann', fax="")
assert res == vcard


if __name__ == '__main__':
pytest.main([__file__])

0 comments on commit f97e0d9

Please sign in to comment.