diff options
| author | Anssi Kääriäinen <akaariai@gmail.com> | 2014-01-20 10:23:40 +0200 |
|---|---|---|
| committer | Anssi Kääriäinen <akaariai@gmail.com> | 2014-01-20 10:52:58 +0200 |
| commit | 980eda01909c9fd5c5e16f276ca663e71371a0a2 (patch) | |
| tree | 6609b45c79f0e9cdae4f34b4bd1d7c3ea0442a13 | |
| parent | 1c360dbbf56b76e1df7c945458ae2987306fcfcd (diff) | |
Fixed custom_lookups tests for Oracle
Refs #21821
| -rw-r--r-- | tests/custom_lookups/tests.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/custom_lookups/tests.py b/tests/custom_lookups/tests.py index 9f1e7fd44a..0ac1780796 100644 --- a/tests/custom_lookups/tests.py +++ b/tests/custom_lookups/tests.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from datetime import date import unittest @@ -16,6 +18,12 @@ class Div3Lookup(models.Lookup): params.extend(rhs_params) return '%s %%%% 3 = %s' % (lhs, rhs), params + def as_oracle(self, qn, connection): + lhs, params = self.process_lhs(qn, connection) + rhs, rhs_params = self.process_rhs(qn, connection) + params.extend(rhs_params) + return 'mod(%s, 3) = %s' % (lhs, rhs), params + class Div3Transform(models.Transform): lookup_name = 'div3' @@ -24,6 +32,10 @@ class Div3Transform(models.Transform): lhs, lhs_params = qn.compile(self.lhs) return '%s %%%% 3' % (lhs,), lhs_params + def as_oracle(self, qn, connection): + lhs, lhs_params = qn.compile(self.lhs) + return 'mod(%s, 3)' % lhs, lhs_params + class YearTransform(models.Transform): lookup_name = 'year' |
