def _numeric_compare(t1, t2):
- return \
- (
- t1.precision is not None and
- t1.precision != t2.precision
- ) or \
- (
- t1.scale is not None and
- t1.scale != t2.scale
- )
+ return (
+ t1.precision is not None and
+ t1.precision != t2.precision
+ ) or (
+ t1.precision is not None and
+ t1.scale is not None and
+ t1.scale != t2.scale
+ )
def _integer_compare(t1, t2):
--- /dev/null
+.. change::
+ :tags: bug, autogenerate
+ :pullreq: bitbucket:70
+
+ Fixed bug where comparison of ``Numeric`` types would produce
+ a difference if the Python-side ``Numeric`` inadvertently specified
+ a non-None "scale" with a "precision" of None, even though this ``Numeric``
+ type will pass over the "scale" argument when rendering. Pull request
+ courtesy Ivan Mmelnychuk.
is_(impl.compare_type(Column('x', t3), Column('x', t2)), True)
is_(impl.compare_type(Column('x', t3), Column('x', t4)), True)
+ def test_numeric_noprecision(self):
+ t1 = Numeric()
+ t2 = Numeric(scale=5)
+
+ impl = self._fixture()
+ is_(impl.compare_type(Column('x', t1), Column('x', t2)), False)
+
def test_integer(self):
t1 = Integer()
t2 = SmallInteger()