TestCurrency.test_eur()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 9
rs 10
c 0
b 0
f 0
cc 1
nop 1
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