Package test_suite :: Package unit_tests :: Package _lib :: Module test_statistics
[hide private]
[frames] | no frames]

Source Code for Module test_suite.unit_tests._lib.test_statistics

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2015 Edward d'Auvergne                                        # 
 4  #                                                                             # 
 5  # This file is part of the program relax (http://www.nmr-relax.com).          # 
 6  #                                                                             # 
 7  # This program is free software: you can redistribute it and/or modify        # 
 8  # it under the terms of the GNU General Public License as published by        # 
 9  # the Free Software Foundation, either version 3 of the License, or           # 
10  # (at your option) any later version.                                         # 
11  #                                                                             # 
12  # This program is distributed in the hope that it will be useful,             # 
13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
15  # GNU General Public License for more details.                                # 
16  #                                                                             # 
17  # You should have received a copy of the GNU General Public License           # 
18  # along with this program.  If not, see <http://www.gnu.org/licenses/>.       # 
19  #                                                                             # 
20  ############################################################################### 
21   
22  # relax module imports. 
23  from lib.statistics import geometric_mean, geometric_std 
24  from test_suite.unit_tests.base_classes import UnitTestCase 
25   
26   
27 -class Test_statistics(UnitTestCase):
28 """Unit tests for the functions of the 'lib.statistics' module.""" 29
30 - def test_geometric_mean(self):
31 """Check the geometric mean value of 4 for the values [2, 8].""" 32 33 # Calculate the mean and check it. 34 mean = geometric_mean(values=[2, 8]) 35 self.assertEqual(mean, 4.0)
36 37
38 - def test_geometric_std(self):
39 """Check the geometric std value of 2 for the values [2, 8].""" 40 41 # Calculate the geometric std and check it. 42 std = geometric_std(values=[2, 8]) 43 self.assertEqual(std, 2.0)
44