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

tests.watcher.test_currency   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 17
dl 0
loc 38
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A TestCurrency.test_usd() 0 9 1
A TestCurrency.test_eur() 0 9 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