Пример #1
0
 def parse_comptarget(self, req):
     """Prase GET fragments that would includes optional arguments such as `gte` and `lte`."""
     gte, lte = req.GET.get('gte', None), req.GET.get('lte', None)
     try:
         gte = dtutils.parse(gte) if gte else dtutils.ago(days=7)
         lte = dtutils.parse(lte) if lte else datetime.now()
     except:
         gte, lte = None, None
     return (gte, lte, )
Пример #2
0
def test_raises_dtutils_parse():
    with raises(ValueError):
        dtutils.parse('1111111111111')
        dtutils.parse('to be failed')
Пример #3
0
def test_dtutils_parse(text, expected):
    assert dtutils.parse(text) == expected
Пример #4
0
def test_raises_dtutils_parse():
    with raises(ValueError):
        dtutils.parse('1111111111111')
        dtutils.parse('to be failed')
Пример #5
0
def test_dtutils_parse(text, expected):
    assert dtutils.parse(text) == expected