kopia lustrzana https://github.com/collective/icalendar
Merge pull request #478 from jacadzaca/refactor_test_unicode_params
refactor test_unicode_parampull/476/head^2
commit
0607510d81
|
@ -0,0 +1,3 @@
|
|||
BEGIN:VEVENT
|
||||
ORGANIZER;CN="Джон Доу":mailto:john.doe@example.org
|
||||
END:VEVENT
|
|
@ -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
|
||||
|
|
|
@ -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."""
|
||||
|
|
|
@ -89,21 +89,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_escaping(self):
|
||||
# verify that escaped non safe chars are decoded correctly
|
||||
NON_SAFE_CHARS = ',\\;:'
|
||||
|
|
Ładowanie…
Reference in New Issue