diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-07-17 10:44:05 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-07-17 10:44:05 -0400 |
commit | b89ca77dca51392c2a31409a4fa2ceb0ad89f44e (patch) | |
tree | e56b30fa55d8a4c50de96e92a4271e2dff3c20e9 | |
parent | 4f2ede42060aeed539b877565e5197f6f9f9817d (diff) | |
parent | ae6fd1c3899f8197250e84bae363c75d0116d082 (diff) | |
download | sqlalchemy-b89ca77dca51392c2a31409a4fa2ceb0ad89f44e.tar.gz |
Merge remote-tracking branch 'origin/pr/188' into pr188
-rw-r--r-- | lib/sqlalchemy/sql/operators.py | 8 | ||||
-rw-r--r-- | test/sql/test_operators.py | 3 |
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/operators.py b/lib/sqlalchemy/sql/operators.py index 51f162c98..17a9d3086 100644 --- a/lib/sqlalchemy/sql/operators.py +++ b/lib/sqlalchemy/sql/operators.py @@ -597,6 +597,14 @@ class ColumnOperators(Operators): """ return self.reverse_operate(div, other) + def __rmod__(self, other): + """Implement the ``%`` operator in reverse. + + See :meth:`.ColumnOperators.__mod__`. + + """ + return self.reverse_operate(mod, other) + def between(self, cleft, cright, symmetric=False): """Produce a :func:`~.expression.between` clause against the parent object, given the lower and upper range. diff --git a/test/sql/test_operators.py b/test/sql/test_operators.py index 0985020d1..65d1e3716 100644 --- a/test/sql/test_operators.py +++ b/test/sql/test_operators.py @@ -1327,6 +1327,9 @@ class MathOperatorTest(fixtures.TestBase, testing.AssertsCompiledSQL): else: self._test_math_op(operator.div, '/') + def test_math_op_mod(self): + self._test_math_op(operator.mod, '%') + class ComparisonOperatorTest(fixtures.TestBase, testing.AssertsCompiledSQL): __dialect__ = 'default' |