kopia lustrzana https://github.com/collective/icalendar
				
				
				
			new timezone test: pacific/fiji
							rodzic
							
								
									6b6366d131
								
							
						
					
					
						commit
						e83f77840b
					
				| 
						 | 
				
			
			@ -0,0 +1,57 @@
 | 
			
		|||
BEGIN:VCALENDAR
 | 
			
		||||
PRODID:-//tzurl.org//NONSGML Olson 2014g//EN
 | 
			
		||||
VERSION:2.0
 | 
			
		||||
BEGIN:VTIMEZONE
 | 
			
		||||
TZID:custom_Pacific/Fiji
 | 
			
		||||
TZURL:http://tzurl.org/zoneinfo/Pacific/Fiji
 | 
			
		||||
X-LIC-LOCATION:Pacific/Fiji
 | 
			
		||||
BEGIN:DAYLIGHT
 | 
			
		||||
TZOFFSETFROM:+1200
 | 
			
		||||
TZOFFSETTO:+1300
 | 
			
		||||
TZNAME:FJST
 | 
			
		||||
DTSTART:20101024T020000
 | 
			
		||||
RRULE:FREQ=YEARLY;BYMONTH=10;BYMONTHDAY=21,22,23,24,25,26,27;BYDAY=SU
 | 
			
		||||
END:DAYLIGHT
 | 
			
		||||
BEGIN:STANDARD
 | 
			
		||||
TZOFFSETFROM:+1300
 | 
			
		||||
TZOFFSETTO:+1200
 | 
			
		||||
TZNAME:FJT
 | 
			
		||||
DTSTART:20140119T020000
 | 
			
		||||
RRULE:FREQ=YEARLY;BYMONTH=1;BYMONTHDAY=18,19,20,21,22,23,24;BYDAY=SU
 | 
			
		||||
END:STANDARD
 | 
			
		||||
BEGIN:STANDARD
 | 
			
		||||
TZOFFSETFROM:+115544
 | 
			
		||||
TZOFFSETTO:+1200
 | 
			
		||||
TZNAME:FJT
 | 
			
		||||
DTSTART:19151026T000000
 | 
			
		||||
RDATE:19151026T000000
 | 
			
		||||
END:STANDARD
 | 
			
		||||
BEGIN:DAYLIGHT
 | 
			
		||||
TZOFFSETFROM:+1200
 | 
			
		||||
TZOFFSETTO:+1300
 | 
			
		||||
TZNAME:FJST
 | 
			
		||||
DTSTART:19981101T020000
 | 
			
		||||
RDATE:19981101T020000
 | 
			
		||||
RDATE:19991107T020000
 | 
			
		||||
RDATE:20091129T020000
 | 
			
		||||
END:DAYLIGHT
 | 
			
		||||
BEGIN:STANDARD
 | 
			
		||||
TZOFFSETFROM:+1300
 | 
			
		||||
TZOFFSETTO:+1200
 | 
			
		||||
TZNAME:FJT
 | 
			
		||||
DTSTART:19990228T030000
 | 
			
		||||
RDATE:19990228T030000
 | 
			
		||||
RDATE:20000227T030000
 | 
			
		||||
RDATE:20100328T030000
 | 
			
		||||
RDATE:20110306T030000
 | 
			
		||||
RDATE:20120122T030000
 | 
			
		||||
RDATE:20130120T030000
 | 
			
		||||
END:STANDARD
 | 
			
		||||
END:VTIMEZONE
 | 
			
		||||
BEGIN:VEVENT
 | 
			
		||||
UID:noend123
 | 
			
		||||
DTSTART;TZID=custom_Pacific/Fiji;VALUE=DATE-TIME:20140829T080000
 | 
			
		||||
DTSTART;TZID=custom_Pacific/Fiji;VALUE=DATE-TIME:20140829T100000
 | 
			
		||||
SUMMARY:an event with a custom tz name
 | 
			
		||||
END:VEVENT
 | 
			
		||||
END:VCALENDAR
 | 
			
		||||
| 
						 | 
				
			
			@ -147,7 +147,7 @@ class TestTimezoned(unittest.TestCase):
 | 
			
		|||
 | 
			
		||||
class TestTimezoneCreation(unittest.TestCase):
 | 
			
		||||
    def test_create_america_new_york(self):
 | 
			
		||||
        """testing the America/New_York, the most complex example from the
 | 
			
		||||
        """testing America/New_York, the most complex example from the
 | 
			
		||||
        RFC"""
 | 
			
		||||
 | 
			
		||||
        directory = os.path.dirname(__file__)
 | 
			
		||||
| 
						 | 
				
			
			@ -172,3 +172,30 @@ class TestTimezoneCreation(unittest.TestCase):
 | 
			
		|||
            (datetime.timedelta(-1, 68400), datetime.timedelta(0), 'EST'),
 | 
			
		||||
            tz._tzinfos.keys()
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    def test_create_pacific_fiji(self):
 | 
			
		||||
        """testing Pacific/Fiji, another pretty complex example with more than
 | 
			
		||||
        one RDATE property per subcomponent"""
 | 
			
		||||
        self.maxDiff = None
 | 
			
		||||
 | 
			
		||||
        directory = os.path.dirname(__file__)
 | 
			
		||||
        cal = icalendar.Calendar.from_ical(
 | 
			
		||||
            open(os.path.join(directory, 'pacific_fiji.ics'), 'rb').read()
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        tz = cal.walk('VEVENT')[0]['DTSTART'][0].dt.tzinfo
 | 
			
		||||
        self.assertEqual(str(tz), 'custom_Pacific/Fiji')
 | 
			
		||||
        pytz_fiji = pytz.timezone('Pacific/Fiji')
 | 
			
		||||
        # pytz first transition time is datetime.datetime(1, 1, 1, 0, 0)
 | 
			
		||||
        self.assertEqual(tz._utc_transition_times[1:-2],
 | 
			
		||||
                         pytz_fiji._utc_transition_times[2:])
 | 
			
		||||
        self.assertEqual(tz._transition_info[1:-2],
 | 
			
		||||
                         pytz_fiji._transition_info[2:])
 | 
			
		||||
        self.assertIn(
 | 
			
		||||
            (datetime.timedelta(0, 46800), datetime.timedelta(0, 3600), 'FJST'),
 | 
			
		||||
            tz._tzinfos.keys()
 | 
			
		||||
        )
 | 
			
		||||
        self.assertIn(
 | 
			
		||||
            (datetime.timedelta(0, 43200), datetime.timedelta(0), 'FJT'),
 | 
			
		||||
            tz._tzinfos.keys()
 | 
			
		||||
        )
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue