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

Source Code for Module test_suite.unit_tests._lib._geometry.test_pec

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2010-2013 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  # Python module imports. 
23  from math import pi 
24  from unittest import TestCase 
25   
26  # relax module imports. 
27  from lib.geometry.pec import pec 
28   
29   
30 -class Test_pec(TestCase):
31 """Unit tests for the lib.geometry.pec relax module.""" 32 33
34 - def test_pec_0_0(self):
35 """Test the pec() function for x = 0, y = 0 (nothing).""" 36 37 # Check the value. 38 self.assertAlmostEqual(pec(0, 0), 0.0)
39 40
41 - def test_pec_0_1(self):
42 """Test the pec() function for x = 0, y = 1 (nothing).""" 43 44 # Check the value. 45 self.assertAlmostEqual(pec(0, 1), 0.0)
46 47
48 - def test_pec_1_0(self):
49 """Test the pec() function for x = 1, y = 0 (nothing).""" 50 51 # Check the value. 52 self.assertAlmostEqual(pec(1, 0), 0.0)
53 54
55 - def test_pec_partial1(self):
56 """Test the pec() function for x = pi/2, y = pi.""" 57 58 # Check the value. 59 self.assertAlmostEqual(pec(pi/2, pi), 9.2141334381797524)
60 61
62 - def test_pec_partial2(self):
63 """Test the pec() function for x = pi/2, y = pi/2.""" 64 65 # Check the value. 66 self.assertAlmostEqual(pec(pi/2, pi/2), 2*pi)
67 68
69 - def test_pec_partial3(self):
70 """Test the pec() function for x = pi/6, y = pi/2.""" 71 72 # Check the value. 73 self.assertAlmostEqual(pec(pi/6, pi/2), 2.3058688920532275)
74 75
76 - def test_pec_pi_pi(self):
77 """Test the pec() function for x = pi, y = pi (full sphere).""" 78 79 # Check the value. 80 self.assertAlmostEqual(pec(pi, pi), 4*pi)
81