def test__make_date_constraint_YYYY_MM_DD_HH(self):
     exp = ('(IFERROR(DATEVALUE(IF(LEN({cell})=4,CONCATENATE({cell},"-01-01"),'
            'IF(LEN({cell})=7,CONCATENATE({cell},"-01"),IF(LEN({cell})=13,'
            'CONCATENATE({cell},":00"),{cell})))),0)+'
            'IFERROR(TIMEVALUE(IF(LEN({cell})=4,CONCATENATE({cell},"-01-01"),'
            'IF(LEN({cell})=7,CONCATENATE({cell},"-01"),IF(LEN({cell})=13,'
            'CONCATENATE({cell},":00"),{cell})))),0))>='
            '(IFERROR(DATEVALUE("2008-12-03 14:00:00"),0)+'
            'IFERROR(TIMEVALUE("2008-12-03 14:00:00"),0))')
     obs = xvb._make_date_constraint(">=", "2008-12-03 14")
     self.assertEqual(exp, obs)
 def test__make_date_constraint_HH_mm(self):
     exp = ('(IFERROR(DATEVALUE(IF(LEN({cell})=4,'
            'CONCATENATE({cell},"-01-01"),'
            'IF(LEN({cell})=7,CONCATENATE({cell},"-01"),IF(LEN({cell})=13,'
            'CONCATENATE({cell},":00"),{cell})))),0)+'
            'IFERROR(TIMEVALUE(IF(LEN({cell})=4,'
            'CONCATENATE({cell},"-01-01"),'
            'IF(LEN({cell})=7,CONCATENATE({cell},"-01"),IF(LEN({cell})=13,'
            'CONCATENATE({cell},":00"),{cell})))),0))>='
            '(IFERROR(DATEVALUE("1900-01-01 14:12:00"),0)+'
            'IFERROR(TIMEVALUE("1900-01-01 14:12:00"),0))')
     obs = xvb._make_date_constraint(">=", "14:12")
     self.assertEqual(exp, obs)
 def test__make_date_constraint_YYYY_MM_DD(self):
     exp = ('(IFERROR(DATEVALUE(IF(LEN({cell})=4,'
            'CONCATENATE({cell},"-01-01"),'
            'IF(LEN({cell})=7,CONCATENATE({cell},"-01"),IF(LEN({cell})=13,'
            'CONCATENATE({cell},":00"),{cell})))),0)+'
            'IFERROR(TIMEVALUE(IF(LEN({cell})=4,'
            'CONCATENATE({cell},"-01-01"),'
            'IF(LEN({cell})=7,CONCATENATE({cell},"-01"),IF(LEN({cell})=13,'
            'CONCATENATE({cell},":00"),{cell})))),0))>'
            '(IFERROR(DATEVALUE("2008-12-03 00:00:00"),0)+'
            'IFERROR(TIMEVALUE("2008-12-03 00:00:00"),0))')
     # NB: this test uses > rather than >= in other tests, just to show it
     # can be done :)
     obs = xvb._make_date_constraint(">", "2008-12-03")
     self.assertEqual(exp, obs)