Exemplo n.º 1
0
 def test_to_field_naive_with_default_tzinfo(self):
     tzinfo = iso8601.FixedOffset(1, 0, 'myname')
     typ = self._makeOne(default_tzinfo=tzinfo)
     dt = self._dt()
     dt_with_tz = dt.replace(tzinfo=tzinfo)
     iso = dt.isoformat()
     result = typ.to_field(iso)
     self.assertEqual(result.isoformat(), dt_with_tz.isoformat())
Exemplo n.º 2
0
 def test_to_field_success(self):
     typ = self._makeOne()
     dt = self._dt()
     tzinfo = iso8601.FixedOffset(1, 0, 'myname')
     dt = dt.replace(tzinfo=tzinfo)
     iso = dt.isoformat()
     result = typ.to_field(iso)
     self.assertEqual(result.isoformat(), iso)
Exemplo n.º 3
0
 def test_to_form_with_tzware_datetime(self):
     typ = self._makeOne()
     dt = self._dt()
     tzinfo = iso8601.FixedOffset(1, 0, 'myname')
     dt = dt.replace(tzinfo=tzinfo)
     result = typ.to_form(dt)
     expected = dt.isoformat()
     self.assertEqual(result, expected)
Exemplo n.º 4
0
 def test_ctor_default_tzinfo_non_None(self):
     tzinfo = iso8601.FixedOffset(1, 0, 'myname')
     typ = self._makeOne(default_tzinfo=tzinfo)
     self.assertEqual(typ.default_tzinfo, tzinfo)
Exemplo n.º 5
0
 def test_parse_no_timezone_different_default(self):
     tz = iso8601.FixedOffset(2, 0, "test offset")
     d = iso8601.parse_date("2007-01-01T08:00:00", default_timezone=tz)
     assert d.tzinfo == tz