def sql(self): sql = 'delete from ' + self.sources.sql() if self.where is not None: sql += ' where ' + self.where.sql() if self.order is not None: sql += ' order by ' + self.order.sql() if self.slice is not None: slc = slice2limit(self.slice) if slc: sql += ' ' + slc return sql
def test_slice2limit_no_args(): limit = util.slice2limit(slice(None)) assert limit is None, limit
def test_slice2limit_lower_and_upper(): limit = util.slice2limit(slice(10, 11)) assert limit == 'limit 10, 1', limit
def test_slice2limit_lower(): limit = util.slice2limit(slice(10, None)) assert limit == 'limit 10, -1', limit
def test_slice2limit_upper(): limit = util.slice2limit(slice(10)) assert limit == 'limit 10', limit