Beispiel #1
0
 def test_now(self):
     now = dates.now()
     self.assertTrue(isinstance(now, datetime.datetime))
Beispiel #2
0
 def test_serialize_datetime(self):
     now = dates.now()
     nowstr = now.isoformat()
     self.assertEqual(nowstr, dates.serialize_datetime(now))
Beispiel #3
0
 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())
Beispiel #4
0
# 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
Beispiel #5
0
 def test_serialize_datetime(self):
     now = dates.now()
     nowstr = now.isoformat()
     self.assertEqual(nowstr, dates.serialize_datetime(now))
Beispiel #6
0
 def test_now(self):
     now = dates.now()
     self.assertTrue(isinstance(now, datetime.datetime))
Beispiel #7
0
# 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