def test_now(self): now = dates.now() self.assertTrue(isinstance(now, datetime.datetime))
def test_serialize_datetime(self): now = dates.now() nowstr = now.isoformat() self.assertEqual(nowstr, dates.serialize_datetime(now))
def test_serialize_datetime_as_date(self): now = dates.now() self.assertTrue(isinstance(now, datetime.datetime)) nowstr = dates.serialize_date(now) self.assertEquals(nowstr, now.date().isoformat())
# Copyright (c) 2015, The MITRE Corporation. All rights reserved. # See LICENSE.txt for complete terms. # builtin import gc import unittest # external from mixbox.vendor import six # internal from mixbox import dates, cache from mixbox.cache import Cached, CacheMiss, MultipleCached NOW = dates.now() class Foo(Cached): def __init__(self, id_=None): super(Foo, self).__init__() self.id_ = id_ self.timestamp = None @property def id_(self): return self._id @id_.setter def id_(self, value): self._id = value