

def test_time(self):
    x = models.TimeClass()
    x.t = datetime.time(12, 12, 12)
    x.d = datetime.date(2008, 3, 12)
    x.dt = datetime.datetime(2008, 3, 12, 12, 12, 12)
    alias = adapter.DjangoClassAlias(models.TimeClass, None)
    attrs = alias.getEncodableAttributes(x)
    self.assertEqual(attrs, {
        'id': None,
        'd': datetime.datetime(2008, 3, 12, 0, 0),
        'dt': datetime.datetime(2008, 3, 12, 12, 12, 12),
        't': datetime.datetime(1970, 1, 1, 12, 12, 12),
    })
    y = models.TimeClass()
    alias.applyAttributes(x, {
        'id': None,
        'd': datetime.datetime(2008, 3, 12, 0, 0),
        'dt': datetime.datetime(2008, 3, 12, 12, 12, 12),
        't': datetime.datetime(1970, 1, 1, 12, 12, 12),
    })
    self.assertEqual(y.id, None)
    self.assertEqual(y.d, datetime.date(2008, 3, 12))
    self.assertEqual(y.dt, datetime.datetime(2008, 3, 12, 12, 12, 12))
    self.assertEqual(y.t, datetime.time(12, 12, 12))
    y = models.TimeClass()
    alias.applyAttributes(y, {
        'id': None,
        'd': None,
        'dt': None,
        't': None,
    })
    self.assertEqual(y.id, None)
    self.assertEqual(y.d, None)
    self.assertEqual(y.dt, None)
    self.assertEqual(y.t, None)

dataset/ETHPy150Open AppScale/appscale/AppServer/lib/PyAMF-0.6.1/pyamf/tests/adapters/test_django.py ClassAliasTestCase.test_time/VarMisuse@177/197 `y`->`x`