Use `isinstance(p, numbers.Rational)` rather than `isinstance(p, fractions.Fraction)`.  I have **no idea** why that matters, but it seems to.
Use a unique tuple rather than a hash as the dictionary key -- hash collisions are unfortunately all too common.
Merge pull request #1315 from mdboom/unit/fix-random-failure

Fix random failure in units unit tests