Package test_suite :: Package unit_tests :: Package _data_store :: Module test_pipe_container
[hide private]
[frames] | no frames]

Source Code for Module test_suite.unit_tests._data_store.test_pipe_container

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2008-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 unittest import TestCase 
24   
25  # relax module imports. 
26  from data_store.pipe_container import PipeContainer 
27   
28   
29 -class Test_pipe_container(TestCase):
30 """Unit tests for the data.pipe_container relax module.""" 31
32 - def setUp(self):
33 """Create a data pipe structure for testing all the object methods.""" 34 35 # The initial empty structure. 36 self.data_pipe = PipeContainer()
37 38
39 - def tearDown(self):
40 """Delete the data pipe.""" 41 42 del self.data_pipe
43 44
45 - def test_PipeContainer_repr(self):
46 """Test the PipeContainer.__repr__() method.""" 47 48 # Add a few objects. 49 self.data_pipe.x = 10 50 self.data_pipe.chi2 = PipeContainer() 51 52 # Test that __repr__() returns a string. 53 self.assert_(type(self.data_pipe.__repr__()), str)
54 55
57 """Test the PipeContainer.__repr__() method for an empty data pipe.""" 58 59 # Test that __repr__() returns a string. 60 self.assert_(type(self.data_pipe.__repr__()), str)
61 62
64 """Tests for the PipeContainer.is_empty() method.""" 65 66 # The newly initialised data pipe should be empty. 67 self.assert_(self.data_pipe.is_empty()) 68 69 # Add an object. 70 self.data_pipe.x = 1 71 self.assert_(not self.data_pipe.is_empty()) 72 73 # Reset the data pipe, and modify an object. 74 self.setUp() 75 self.data_pipe.mol[0].name = 'Ap4Aase' 76 self.assert_(not self.data_pipe.is_empty()) 77 78 # The pipe type can be set in the empty data pipe. 79 self.setUp() 80 self.data_pipe.pipe_type = 'mf' 81 self.assert_(self.data_pipe.is_empty())
82