Exemplo n.º 1
0
def test_datetime_from_sec_and_nano_with_dst():
    seconds = 1392663073
    nanoseconds = 987654321
    dt = utils.datetime_from_sec_and_nano(seconds, nanoseconds, melbourne_tz)
    dt_correct = melbourne_tz.localize(datetime(2014, 2, 18, 5, 51, 13, 987654))
    assert dt == dt_correct
    assert dt.utcoffset() == timedelta(0, 39600)
Exemplo n.º 2
0
 def test_datetime_from_sec_and_nano_with_utc(self):
     seconds = 1342129643
     nanoseconds = 123456789
     dt = utils.datetime_from_sec_and_nano(seconds, nanoseconds, utils.utc)
     # Note nanoseconds get rounded off in conversion to microseconds
     self.assertEqual(
         dt, datetime.datetime(2012, 7, 12, 21, 47, 23, 123457, utils.utc))
Exemplo n.º 3
0
 def test_datetime_from_sec_and_nano_with_tz(self):
     seconds = 1376706013
     nanoseconds = 123456789
     tz = AEST()
     dt = utils.datetime_from_sec_and_nano(seconds, nanoseconds, tz)
     self.assertEqual(
         dt, datetime.datetime(2013, 8, 17, 12, 20, 13, 123457, AEST()))
Exemplo n.º 4
0
 def test_datetime_from_sec_and_nano_near_1e9_ns(self):
     seconds = 1376706013
     nanoseconds = 999999500
     dt = utils.datetime_from_sec_and_nano(seconds, nanoseconds)
     # Note nanoseconds get rounded off in conversion to microseconds
     self.assertEqual(
         dt, datetime.datetime(2013, 8, 17, 2, 20, 14, 0, utils.utc))
Exemplo n.º 5
0
 def test_datetime_from_sec_and_nano(self):
     seconds = 1376706013
     nanoseconds = 123456789
     dt = utils.datetime_from_sec_and_nano(seconds, nanoseconds)
     # Note nanoseconds get rounded off in conversion to microseconds
     self.assertEqual(
         dt, datetime.datetime(2013, 8, 17, 2, 20, 13, 123457, utils.utc))
Exemplo n.º 6
0
def test_datetime_from_sec_and_nano_with_dst():
    seconds = 1392663073
    nanoseconds = 987654321
    dt = utils.datetime_from_sec_and_nano(seconds, nanoseconds, melbourne_tz)
    dt_correct = melbourne_tz.localize(datetime(2014, 2, 18, 5, 51, 13,
                                                987654))
    assert dt == dt_correct
    assert dt.utcoffset() == timedelta(0, 39600)
Exemplo n.º 7
0
def test_datetime_from_sec_and_nano_with_tz():
    seconds = 1376706013
    nanoseconds = 123456789
    tz = AEST()
    dt = utils.datetime_from_sec_and_nano(seconds, nanoseconds, tz)
    assert dt == datetime(2013, 8, 17, 12, 20, 13, 123457, AEST())
Exemplo n.º 8
0
def test_datetime_from_sec_and_nano_with_utc():
    seconds = 1342129643
    nanoseconds = 123456789
    dt = utils.datetime_from_sec_and_nano(seconds, nanoseconds, utils.utc)
    # Note nanoseconds get rounded off in conversion to microseconds
    assert dt == datetime(2012, 7, 12, 21, 47, 23, 123457, utils.utc)
Exemplo n.º 9
0
def test_datetime_from_sec_and_nano_near_1e9_ns():
    seconds = 1376706013
    nanoseconds = 999999500
    dt = utils.datetime_from_sec_and_nano(seconds, nanoseconds)
    # Note nanoseconds get rounded off in conversion to microseconds
    assert dt == datetime(2013, 8, 17, 2, 20, 14, 0, utils.utc)
Exemplo n.º 10
0
def test_datetime_from_sec_and_nano():
    seconds = 1376706013
    nanoseconds = 123456789
    dt = utils.datetime_from_sec_and_nano(seconds, nanoseconds)
    # Note nanoseconds get rounded off in conversion to microseconds
    assert dt == datetime(2013, 8, 17, 2, 20, 13, 123457, utils.utc)
Exemplo n.º 11
0
def test_datetime_from_sec_and_nano_with_tz():
    seconds = 1376706013
    nanoseconds = 123456789
    tz = AEST()
    dt = utils.datetime_from_sec_and_nano(seconds, nanoseconds, tz)
    assert dt == datetime(2013, 8, 17, 12, 20, 13, 123457, AEST())
Exemplo n.º 12
0
 def test_datetime_from_sec_and_nano_with_tz(self):
     seconds = 1376706013
     nanoseconds = 123456789
     tz = AEST()
     dt = utils.datetime_from_sec_and_nano(seconds, nanoseconds, tz)
     self.assertEqual(dt, datetime.datetime(2013, 8, 17, 12, 20, 13, 123457, AEST()))