projects
/
pyutils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
More work to improve documentation generated by sphinx. Also fixes
[pyutils.git]
/
tests
/
typez
/
money_test.py
diff --git
a/tests/typez/money_test.py
b/tests/typez/money_test.py
index ee1e3923bc5bdaec7adac3df74c59b703b032a1e..e296e5154a02f242c44e21e9c1be3df4243b45e9 100755
(executable)
--- a/
tests/typez/money_test.py
+++ b/
tests/typez/money_test.py
@@
-5,6
+5,7
@@
"""money unittest."""
import unittest
"""money unittest."""
import unittest
+from decimal import Decimal
from pyutils import unittest_utils
from pyutils.typez.money import Money
from pyutils import unittest_utils
from pyutils.typez.money import Money
@@
-97,9
+98,13
@@
class TestMoney(unittest.TestCase):
def test_truncate_and_round(self):
ten = Money(10.0)
x = ten * 2 / 3
def test_truncate_and_round(self):
ten = Money(10.0)
x = ten * 2 / 3
- self.assertEqual(6.66, x.truncate_fractional_cents())
+ expected = Decimal(6.66)
+ expected = expected.quantize(Decimal('.01'))
+ self.assertEqual(expected, x.truncate_fractional_cents())
x = ten * 2 / 3
x = ten * 2 / 3
- self.assertEqual(6.67, x.round_fractional_cents())
+ expected = Decimal(6.67)
+ expected = expected.quantize(Decimal('.01'))
+ self.assertEqual(expected, x.round_fractional_cents())
if __name__ == '__main__':
if __name__ == '__main__':