'Test virtual field string value comparison against
date/time value'

def testDateTimeComparison(self):

    assertTrue = self.assertTrue
    assertFalse = self.assertFalse
    resource = current.s3db.resource('org_organisation')
    row = Storage()
    query = (FS('test') == datetime.datetime(2014, 10, 5).date())
    row.test = '2014-10-05'
    assertTrue(query(resource, row))
    row.test = '2013-12-02'
    assertFalse(query(resource, row))
    row.test = ''
    assertFalse(query(resource, row))
    query = (FS('test') == datetime.datetime(2014, 10, 5, 10, 0, 0))
    row.test = '2014-10-05    10:00:00'
    assertTrue(query(resource, row))
    row.test = '2014-10-05    11:00:00'
    assertFalse(query(resource, row))
    row.test = '2013-12-02'
    assertFalse(query(resource, row))
    row.test = ''
    assertFalse(query(resource, row))
    query = (FS('test') == datetime.time(10, 0, 0))
    row.test = '10:00:00'
    assertTrue(query(resource, row))
    row.test = '11:00:00'
    assertFalse(query(resource, row))
    row.test = '2013-12-02'
    assertFalse(query(resource, row))
    row.test = ''
    assertFalse(query(resource, row))
