diff --git a/pint/quantity.py b/pint/quantity.py index 138e17aa6..cfc5d93bf 100644 --- a/pint/quantity.py +++ b/pint/quantity.py @@ -771,6 +771,8 @@ def _get_reduced_units(self, units): if unit1 not in units: continue for unit2 in units: + # get exponent after reduction + exp = units[unit1] if unit1 != unit2: power = self._REGISTRY._get_dimensionality_ratio(unit1, unit2) if power: diff --git a/pint/testsuite/test_quantity.py b/pint/testsuite/test_quantity.py index b5413f4c1..998a53daa 100644 --- a/pint/testsuite/test_quantity.py +++ b/pint/testsuite/test_quantity.py @@ -642,6 +642,9 @@ def test_to_reduced_units(self): q.to_reduced_units(), self.Q_([3000.0, 4000.0], "ms**2") ) + q = self.Q_(0.5, "g*t/kg") + helpers.assert_quantity_equal(q.to_reduced_units(), self.Q_(0.5, "kg")) + class TestQuantityToCompact(QuantityTestCase): def assertQuantityAlmostIdentical(self, q1, q2):