def test_units_match(): class XxxMoney(int): currency = 'XXX' m1 = Money(1, 'EUR') m2 = Money(2, 'EUR') m3 = Money(3, 'XXX') m4 = XxxMoney(4) assert m1.unit_matches_with(m2) assert not m1.unit_matches_with(m3) assert m3.unit_matches_with(m4)