Exemplo n.º 1
0
 def test_timestamp_arbitrary_parse(self):
     tz = pytz.timezone('Africa/Nairobi')
     timezone.activate(tz)
     field = DateTimeTzSerializerField()
     timestamp = aware_datetime()
     self.assertEqual(field.to_internal_value(timestamp.isoformat()).tzinfo, aware_datetime().tzinfo)
     timezone.deactivate()
Exemplo n.º 2
0
 def test_timestamp_utc_parse(self):
     timezone.activate(pytz.utc)
     field = DateTimeTzSerializerField()
     timestamp = aware_datetime()
     self.assertEqual(
         field.to_internal_value(timestamp.isoformat()).tzinfo,
         aware_datetime().tzinfo)
     timezone.deactivate()
Exemplo n.º 3
0
 def test_timestamp_arbitrary_parse(self):
     tz = pytz.timezone('Africa/Nairobi')
     timezone.activate(tz)
     field = DateTimeTzSerializerField()
     timestamp = aware_datetime()
     self.assertEqual(
         field.to_internal_value(timestamp.isoformat()).tzinfo,
         aware_datetime().tzinfo)
     timezone.deactivate()
Exemplo n.º 4
0
 def test_timestamp_utc_parse(self):
     timezone.activate(pytz.utc)
     field = DateTimeTzSerializerField()
     timestamp = aware_datetime()
     self.assertEqual(field.to_internal_value(timestamp.isoformat()).tzinfo, aware_datetime().tzinfo)
     timezone.deactivate()