示例#1
0
文件: test_helpers.py 项目: gerv/kuma
 def test_future(self):
     """Test behavior when date is in the future and also when omitting the
     `now` kwarg."""
     eq_('', timesince(datetime(9999, 1, 2)))
示例#2
0
文件: test_helpers.py 项目: gerv/kuma
 def test_none(self):
     """If None is passed in, timesince returns ''."""
     eq_('', timesince(None))
示例#3
0
文件: test_helpers.py 项目: gerv/kuma
 def test_trunc(self):
     """Assert it returns only the most significant time division."""
     eq_('1 year ago',
         timesince(datetime(2000, 1, 2), now=datetime(2001, 2, 3)))
示例#4
0
 def test_future(self):
     """Test behavior when date is in the future and also when omitting the
     `now` kwarg."""
     eq_('', timesince(datetime(9999, 1, 2)))
示例#5
0
 def test_trunc(self):
     """Assert it returns only the most significant time division."""
     eq_('1 year ago',
         timesince(datetime(2000, 1, 2), now=datetime(2001, 2, 3)))
示例#6
0
 def test_none(self):
     """If None is passed in, timesince returns ''."""
     eq_('', timesince(None))
示例#7
0
文件: helpers.py 项目: timmi/kitsune
def utctimesince(time, now=None):
    now = now or datetime.utcnow()
    return timesince(time, now)
示例#8
0
def utctimesince(time, now=None):
    now = now or datetime.utcnow()
    return timesince(time, now)