Total Complexity | 2 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | #!/usr/bin/python |
||
2 | # -*- coding: utf-8 -*- |
||
3 | import unittest |
||
4 | |||
5 | from kuon.watcher.currency import Currency |
||
6 | |||
7 | |||
8 | class TestCurrency(unittest.TestCase): |
||
9 | """ |
||
10 | test cases for the currency module of the watcher |
||
11 | """ |
||
12 | |||
13 | def test_usd(self) -> None: |
||
14 | """Test currency with default settings(sign = $ and sign before the amount) |
||
15 | |||
16 | :return: |
||
17 | """ |
||
18 | currency = Currency(1501) |
||
19 | self.assertEqual(str(currency), currency.human_readable) |
||
20 | self.assertEqual(currency.human_readable, "$15.01") |
||
21 | self.assertEqual(currency.amount, 1501) |
||
22 | |||
23 | def test_eur(self) -> None: |
||
24 | """Test currency with euro settings(sign = € and sign after the amount) |
||
25 | |||
26 | :return: |
||
27 | """ |
||
28 | currency = Currency(4201, currency_sign="€", currency_sign_start=False) |
||
29 | self.assertEqual(str(currency), currency.human_readable) |
||
30 | self.assertEqual(currency.human_readable, "42.01€") |
||
31 | self.assertEqual(currency.amount, 4201) |
||
32 | |||
33 | |||
34 | if __name__ == '__main__': |
||
35 | suite = unittest.TestLoader().loadTestsFromTestCase(TestCurrency) |
||
36 | unittest.TextTestRunner(verbosity=2).run(suite) |
||
37 |