annotate hgext3rd/fastimport/vendor/python_fastimport/tests/test_dates.py @ 86:28704a2a7461 vendor/python-fastimport

Import python-fastimport-0.9.8
author Roy Marples <roy@marples.name>
date Tue, 19 Jan 2021 22:56:34 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
86
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
1 # Copyright (C) 2012 Canonical Ltd
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
2 #
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
3 # This program is free software; you can redistribute it and/or modify
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
4 # it under the terms of the GNU General Public License as published by
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
5 # the Free Software Foundation; either version 2 of the License, or
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
6 # (at your option) any later version.
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
7 #
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
8 # This program is distributed in the hope that it will be useful,
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
11 # GNU General Public License for more details.
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
12 #
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
13 # You should have received a copy of the GNU General Public License
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
15
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
16 """Test parsing of dates."""
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
17
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
18 from unittest import TestCase
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
19
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
20 from fastimport import (
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
21 dates,
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
22 )
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
23
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
24 class ParseTzTests(TestCase):
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
25
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
26 def test_parse_tz_utc(self):
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
27 self.assertEqual(0, dates.parse_tz(b'+0000'))
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
28 self.assertEqual(0, dates.parse_tz(b'-0000'))
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
29
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
30 def test_parse_tz_cet(self):
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
31 self.assertEqual(3600, dates.parse_tz(b'+0100'))
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
32
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
33 def test_parse_tz_odd(self):
28704a2a7461 Import python-fastimport-0.9.8
Roy Marples <roy@marples.name>
parents:
diff changeset
34 self.assertEqual(1864800, dates.parse_tz(b'+51800'))