Esempio n. 1
0
 def test(self, value):
     if not(
         isinstance(value, datetime.datetime) or
         (isinstance(value, string_types) and is_date(value))
         ):
          return False
     return CellType.test(self, value)
Esempio n. 2
0
 def test_date_regex(self):
     assert dateparser.is_date('2012 12 22')
     assert dateparser.is_date('2012/12/22')
     assert dateparser.is_date('2012-12-22')
     assert dateparser.is_date('22.12.2012')
     assert dateparser.is_date('12 12 22')
     assert dateparser.is_date('22 Dec 2012')
     assert dateparser.is_date('2012 12 22 13:17')
     assert dateparser.is_date('2012 12 22 T 13:17')
Esempio n. 3
0
 def test_date_regex(self):
     assert dateparser.is_date('2012 12 22')
     assert dateparser.is_date('2012/12/22')
     assert dateparser.is_date('2012-12-22')
     assert dateparser.is_date('22.12.2012')
     assert dateparser.is_date('12 12 22')
     assert dateparser.is_date('22 Dec 2012')
     assert dateparser.is_date('2012 12 22 13:17')
     assert dateparser.is_date('2012 12 22 T 13:17')
Esempio n. 4
0
 def test(cls, value):
     if isinstance(value, basestring) and not is_date(value):
         return
     for v in cls.formats:
         ins = cls(v)
         try:
             ins.cast(value)
             return ins
         except:
             pass
Esempio n. 5
0
 def test(cls, value):
     if not is_date(value):
         return
     for v in cls.formats:
         ins = cls(v)
         try:
             ins.cast(value)
             return ins
         except:
             pass
Esempio n. 6
0
 def test(cls, value):
     if not is_date(value):
         return
     for v in cls.formats:
         ins = cls(v)
         try:
             ins.cast(value)
             return ins
         except:
             pass
Esempio n. 7
0
 def test(self, value):
     if isinstance(value, string_types) and not is_date(value):
         return False
     return CellType.test(self, value)
Esempio n. 8
0
 def test(self, value):
     if isinstance(value, basestring) and not is_date(value):
         return False
     return CellType.test(self, value)
Esempio n. 9
0
 def test(self, value):
     if not (isinstance(value, datetime.datetime) or
             (isinstance(value, string_types) and is_date(value))):
         return False
     return CellType.test(self, value)