hgrecco/pint — pull request #14 by jeremyfreeman (2013-04-10 03:08:34+00:00)
Title: Bug in the str(Quantity.units) when multiple units in the denominator

example of bug:
q = Q_(1, 'g/(m**2*s)')
# gram / meter ** 2 * seconds
# not gram / (meter **2 * seconds)

Test is added. Note tests/test_pint.py passes. Others fail consistently
before and after this change.

I expect that I can save a Quantity as a tuple (q.magnitude, str(q.units) to a database and reconstruct the quantity by Quantity(* (q.magnitude, str(q.units) ).

This fails when multiple units are in the denominator. The denominator needs to be wrapped in parens to get the correct operator precedence when re-parsing the units.