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