Exemplo n.º 1
0
 def test_INTERNALDATE_normalised(self):
     output = parse_fetch_response([b'3 (INTERNALDATE " 9-Feb-2007 17:08:08 -0430")'])
     dt = output[3][b'INTERNALDATE']
     self.assertTrue(dt.tzinfo is None)   # Returned date should be in local timezone
     expected_dt = datetime_to_native(
         datetime(2007, 2, 9, 17, 8, 8, 0, FixedOffset(-4 * 60 - 30)))
     self.assertEqual(dt, expected_dt)
Exemplo n.º 2
0
 def test_INTERNALDATE_normalised(self):
     output = parse_fetch_response([b'3 (INTERNALDATE " 9-Feb-2007 17:08:08 -0430")'])
     dt = output[3][b'INTERNALDATE']
     self.assertTrue(dt.tzinfo is None)   # Returned date should be in local timezone
     expected_dt = datetime_to_native(
         datetime(2007, 2, 9, 17, 8, 8, 0, FixedOffset(-4 * 60 - 30)))
     self.assertEqual(dt, expected_dt)
Exemplo n.º 3
0
 def check_normalised_and_not(self, in_string, expected_datetime):
     self.assertEqual(
         parse_to_datetime(in_string),
         datetime_to_native(expected_datetime)
     )
     self.assertEqual(
         parse_to_datetime(in_string, normalise=False),
         expected_datetime
     )
Exemplo n.º 4
0
 def test_mixed_types(self):
     self.assertEqual(parse_fetch_response([(
         b'1 (INTERNALDATE " 9-Feb-2007 17:08:08 +0100" RFC822 {21}',
         b'Subject: test\r\n\r\nbody'
     ), b')']), {
         1: {
             b'INTERNALDATE': datetime_to_native(datetime(2007, 2, 9, 17, 8, 8, 0, FixedOffset(60))),
             b'RFC822': b'Subject: test\r\n\r\nbody',
             b'SEQ': 1
         }
     })
Exemplo n.º 5
0
 def test_mixed_types(self):
     self.assertEqual(parse_fetch_response([(
         b'1 (INTERNALDATE " 9-Feb-2007 17:08:08 +0100" RFC822 {21}',
         b'Subject: test\r\n\r\nbody'
     ), b')']), {
         1: {
             b'INTERNALDATE': datetime_to_native(datetime(2007, 2, 9, 17, 8, 8, 0, FixedOffset(60))),
             b'RFC822': b'Subject: test\r\n\r\nbody',
             b'SEQ': 1
         }
     })
Exemplo n.º 6
0
 def check_normalised_and_not(self, in_string, expected_datetime):
     self.assertEqual(parse_to_datetime(in_string),
                      datetime_to_native(expected_datetime))
     self.assertEqual(parse_to_datetime(in_string, normalise=False),
                      expected_datetime)