1
0

Improved error message
Some checks failed
Python Ruff Code Quality / ruff (push) Successful in 23s
Run Python tests (through Pytest) / Test (push) Failing after 25s
Verify Python project can be installed, loaded and have version checked / Test (push) Successful in 21s

This commit is contained in:
Jon Michael Aanes 2024-12-15 21:24:02 +01:00
parent 3b50e0ecf0
commit a8a58dd596
Signed by: Jmaa
SSH Key Fingerprint: SHA256:Ab0GfHGCblESJx7JRE4fj4bFy/KRpeLhi41y4pF3sNA

View File

@ -574,7 +574,7 @@ class AssetAmount:
def __truediv__(self, other: 'Decimal | AssetAmount') -> 'Decimal | AssetAmount': def __truediv__(self, other: 'Decimal | AssetAmount') -> 'Decimal | AssetAmount':
if isinstance(other, AssetAmount): if isinstance(other, AssetAmount):
if self.asset != other.asset: if self.asset != other.asset:
msg = f'AssetAmount must have same asset, but: {self.asset} != {other.asset}' msg = f'Attempting to divide {self} by {other}, but these must have the same asset'
raise ValueError(msg) raise ValueError(msg)
return self.amount / other.amount return self.amount / other.amount
return AssetAmount(self.asset, self.amount / other) return AssetAmount(self.asset, self.amount / other)