refactor test_unicode_param

pull/478/head
jaca 2022-10-20 19:46:38 +02:00
rodzic 2528641242
commit 9044270586
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B67CEF4EE3D609B0
4 zmienionych plików z 12 dodań i 20 usunięć

Wyświetl plik

@ -0,0 +1,3 @@
BEGIN:VEVENT
ORGANIZER;CN="Джон Доу":mailto:john.doe@example.org
END:VEVENT

Wyświetl plik

@ -23,11 +23,14 @@ def test_event_from_ical_respects_unicode(test_input, field, expected_value, eve
event = events[test_input]
assert event[field].to_ical().decode('utf-8') == expected_value
def test_events_parameter_unicoded(events):
'''chokes on umlauts in ORGANIZER
https://github.com/collective/icalendar/issues/101
'''
assert events.issue_101_icalendar_chokes_on_umlauts_in_organizer['ORGANIZER'].params['CN'] == 'acme, ädmin'
@pytest.mark.parametrize('test_input, expected_output', [
# chokes on umlauts in ORGANIZER
# https://github.com/collective/icalendar/issues/101
('issue_101_icalendar_chokes_on_umlauts_in_organizer', 'acme, ädmin'),
('event_with_unicode_organizer', 'Джон Доу'),
])
def test_events_parameter_unicoded(events, test_input, expected_output):
assert events[test_input]['ORGANIZER'].params['CN'] == expected_output
def test_parses_event_with_non_ascii_tzid_issue_237(calendars, in_timezone):
"""Issue #237 - Fail to parse timezone with non-ascii TZID

Wyświetl plik

@ -79,6 +79,7 @@ def test_issue_157_removes_trailing_semicolon(events):
# PERIOD should be put back into shape
'issue_156_RDATE_with_PERIOD',
'issue_156_RDATE_with_PERIOD_list',
'event_with_unicode_organizer',
])
def test_event_to_ical_is_inverse_of_from_ical(events, event_name):
"""Make sure that an event's ICS is equal to the ICS it was made from."""

Wyświetl plik

@ -30,21 +30,6 @@ class TestPropertyParams(unittest.TestCase):
ical2 = Calendar.from_ical(ical_str)
self.assertEqual(ical2.get('ORGANIZER').params.get('CN'), 'Doe, John')
def test_unicode_param(self):
cal_address = vCalAddress('mailto:john.doe@example.org')
cal_address.params["CN"] = "Джон Доу"
vevent = Event()
vevent['ORGANIZER'] = cal_address
self.assertEqual(
vevent.to_ical().decode('utf-8'),
'BEGIN:VEVENT\r\n'
'ORGANIZER;CN="Джон Доу":mailto:john.doe@example.org\r\n'
'END:VEVENT\r\n'
)
self.assertEqual(vevent['ORGANIZER'].params['CN'],
'Джон Доу')
def test_quoting(self):
# not double-quoted
self._test_quoting("Aramis", 'Aramis')