Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(21)

Delta Between Two Patch Sets: Lib/test/datetimetester.py

Issue 15873: "datetime" cannot parse ISO 8601 dates and times
Left Patch Set: Created 3 years, 6 months ago
Right Patch Set: Created 3 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Lib/datetime.py ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 """Test date/time type. 1 """Test date/time type.
2 2
3 See http://www.zope.org/Members/fdrake/DateTimeWiki/TestCases 3 See http://www.zope.org/Members/fdrake/DateTimeWiki/TestCases
4 """ 4 """
5 from test.support import is_resource_enabled 5 from test.support import is_resource_enabled
6 6
7 import itertools 7 import itertools
8 import bisect 8 import bisect
9 9
10 import copy 10 import copy
(...skipping 2419 matching lines...) Expand 10 before | Expand all | Expand 10 after
2430 self.theclass(10, 20, 30, 400001)) 2430 self.theclass(10, 20, 30, 400001))
2431 # usec, rounding low + long digits we don't care about 2431 # usec, rounding low + long digits we don't care about
2432 self.assertEqual(self.theclass.fromisoformat('10:20:30.400003434'), 2432 self.assertEqual(self.theclass.fromisoformat('10:20:30.400003434'),
2433 self.theclass(10, 20, 30, 400003)) 2433 self.theclass(10, 20, 30, 400003))
2434 with self.assertRaises(ValueError): 2434 with self.assertRaises(ValueError):
2435 self.theclass.fromisoformat('12:00AM') 2435 self.theclass.fromisoformat('12:00AM')
2436 with self.assertRaises(ValueError): 2436 with self.assertRaises(ValueError):
2437 self.theclass.fromisoformat('120000') 2437 self.theclass.fromisoformat('120000')
2438 with self.assertRaises(ValueError): 2438 with self.assertRaises(ValueError):
2439 self.theclass.fromisoformat('1:00') 2439 self.theclass.fromisoformat('1:00')
2440 with self.assertRaises(ValueError):
2441 self.theclass.fromisoformat('17:54:43.')
2440 2442
2441 def tz(h, m): 2443 def tz(h, m):
2442 return timezone(timedelta(hours=h, minutes=m)) 2444 return timezone(timedelta(hours=h, minutes=m))
2443 2445
2444 self.assertEqual(self.theclass.fromisoformat('00:00:00Z'), 2446 self.assertEqual(self.theclass.fromisoformat('00:00:00Z'),
2445 self.theclass(0, 0, 0, tzinfo=timezone.utc)) 2447 self.theclass(0, 0, 0, tzinfo=timezone.utc))
2446 # lowercase UTC timezone. Uncommon but tolerated (rfc 3339) 2448 # lowercase UTC timezone. Uncommon but tolerated (rfc 3339)
2447 self.assertEqual(self.theclass.fromisoformat('00:00:00z'), 2449 self.assertEqual(self.theclass.fromisoformat('00:00:00z'),
2448 self.theclass(0, 0, 0, tzinfo=timezone.utc)) 2450 self.theclass(0, 0, 0, tzinfo=timezone.utc))
2449 self.assertEqual(self.theclass.fromisoformat('00:00:00-00:00'), 2451 self.assertEqual(self.theclass.fromisoformat('00:00:00-00:00'),
(...skipping 2416 matching lines...) Expand 10 before | Expand all | Expand 10 after
4866 class IranTest(ZoneInfoTest): 4868 class IranTest(ZoneInfoTest):
4867 zonename = 'Asia/Tehran' 4869 zonename = 'Asia/Tehran'
4868 4870
4869 def load_tests(loader, standard_tests, pattern): 4871 def load_tests(loader, standard_tests, pattern):
4870 standard_tests.addTest(ZoneInfoCompleteTest()) 4872 standard_tests.addTest(ZoneInfoCompleteTest())
4871 return standard_tests 4873 return standard_tests
4872 4874
4873 4875
4874 if __name__ == "__main__": 4876 if __name__ == "__main__":
4875 unittest.main() 4877 unittest.main()
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+