exercises01test   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 28
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A Testcase.test_variance() 0 3 1
A Testcase.test_mean() 0 3 1
A Testcase.test_stddev() 0 3 1
1
#!/usr/bin/env python3
2 1
"""
3
test exercise 01 functions
4
"""
5
6 1
import unittest
7 1
import exercises01 as matmod
8
9 1
class Testcase(unittest.TestCase):
10
    """
11
    Test class using python unittest
12
    """
13 1
    def test_mean(self):
14
        """ test mean function """
15 1
        self.assertEqual(matmod.mean([1, 1, 1, 1, 3, 4, 5]), 2.29)
16
17
18 1
    def test_variance(self):
19
        """ test variance function """
20 1
        self.assertEqual(matmod.variance([1, 1, 1, 1, 3, 4, 5, 1, 1, 10, 11]), 13.87)
21
22 1
    def test_stddev(self):
23
        """ test standard deviation """
24 1
        self.assertEqual(matmod.stddev([1, 2, -2, 4, -3]), 2.88)
25
26 1
if __name__ == '__main__':
27
    unittest.main()
28