From 880fde785bf1aa4c889aca8efb215e0f431212c3 Mon Sep 17 00:00:00 2001 From: Victor Varvaryuk Date: Wed, 3 Apr 2013 16:39:05 +0400 Subject: [PATCH] Created a failing test. --- src/icalendar/tests/test_fixed_issues.py | 12 +++++++++--- src/icalendar/tests/test_timezoned.py | 1 + src/icalendar/tests/test_unit_cal.py | 2 +- src/icalendar/tests/test_unit_tools.py | 3 ++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/icalendar/tests/test_fixed_issues.py b/src/icalendar/tests/test_fixed_issues.py index 5f48189..e869a82 100644 --- a/src/icalendar/tests/test_fixed_issues.py +++ b/src/icalendar/tests/test_fixed_issues.py @@ -5,6 +5,7 @@ import datetime import os import pytz + class TestIssues(unittest.TestCase): @@ -61,7 +62,7 @@ END:VTIMEZONE""" # specified in UTC." event = icalendar.Event() - dt = pytz.utc.localize(datetime.datetime(2012,7,16,0,0,0)) + dt = pytz.utc.localize(datetime.datetime(2012, 7, 16, 0, 0, 0)) event.add('dtstart', dt) self.assertEqual(event.to_ical(), "BEGIN:VEVENT\r\n" @@ -76,7 +77,7 @@ END:VTIMEZONE""" # Non-unicode characters event = icalendar.Event() - event.add("dtstart", datetime.datetime(2012,9,3,0,0,0)) + event.add("dtstart", datetime.datetime(2012, 9, 3, 0, 0, 0)) event.add("summary", u"abcdef") self.assertEqual(event.to_ical(), "BEGIN:VEVENT\r\nSUMMARY:abcdef\r\nDTSTART;VALUE=DATE-TIME:" @@ -84,7 +85,7 @@ END:VTIMEZONE""" # Unicode characters event = icalendar.Event() - event.add("dtstart", datetime.datetime(2012,9,3,0,0,0)) + event.add("dtstart", datetime.datetime(2012, 9, 3, 0, 0, 0)) event.add("summary", u"åäö") self.assertEqual(event.to_ical(), "BEGIN:VEVENT\r\nSUMMARY:\xc3\xa5\xc3\xa4\xc3\xb6\r\n" @@ -130,3 +131,8 @@ END:VEVENT""" "BEGIN:VEVENT\r\nATTACH;ENCODING=BASE64;FMTTYPE=text/plain;" "VALUE=BINARY:dGV4dA==\r\nEND:VEVENT\r\n" ) + + + def test_wrong_values(self): + ical_content = "BEGIN:VEVENT\r\nSUMMARY;LANGUAGE=ru:te\r\nEND:VEVENT" + icalendar.Event.from_ical(ical_content).to_ical() diff --git a/src/icalendar/tests/test_timezoned.py b/src/icalendar/tests/test_timezoned.py index 3dea4ff..7232e15 100644 --- a/src/icalendar/tests/test_timezoned.py +++ b/src/icalendar/tests/test_timezoned.py @@ -7,6 +7,7 @@ import os from . import unittest + class TestTimezoned(unittest.TestCase): def test_create_from_ical(self): diff --git a/src/icalendar/tests/test_unit_cal.py b/src/icalendar/tests/test_unit_cal.py index 33b1011..6aee981 100644 --- a/src/icalendar/tests/test_unit_cal.py +++ b/src/icalendar/tests/test_unit_cal.py @@ -46,7 +46,7 @@ class TestCalComponent(unittest.TestCase): # With default values for non existing properties self.assertEqual(c.decoded('version', 'No Version'), 'No Version') - c.add('rdate', [datetime(2013,3,28), datetime(2013,3,27)]) + c.add('rdate', [datetime(2013, 3, 28), datetime(2013, 3, 27)]) self.assertEqual(type(c.decoded('rdate')), prop.vDDDLists) # The component can render itself in the RFC 2445 format. diff --git a/src/icalendar/tests/test_unit_tools.py b/src/icalendar/tests/test_unit_tools.py index a4627b6..19d72b6 100644 --- a/src/icalendar/tests/test_unit_tools.py +++ b/src/icalendar/tests/test_unit_tools.py @@ -1,6 +1,7 @@ from . import unittest from icalendar.tools import UIDGenerator + class TestTools(unittest.TestCase): def test_tools_UIDGenerator(self): @@ -9,7 +10,7 @@ class TestTools(unittest.TestCase): g = UIDGenerator() uid = g.uid() txt = uid.to_ical() - length = 15+1+16+1+11 + length = 15 + 1 + 16 + 1 + 11 self.assertTrue(len(txt) == length) self.assertTrue('@example.com' in txt)