Completed
Push — master ( 72b331...d4b7d2 )
by Steffen
02:14
created

TestCurrency.test_usd()   A

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
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