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

Source Code for Module test_suite.unit_tests._data.test_pipe_container

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2008 Edward d'Auvergne                                        # 
 4  #                                                                             # 
 5  # This file is part of the program relax.                                     # 
 6  #                                                                             # 
 7  # relax 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 2 of the License, or           # 
10  # (at your option) any later version.                                         # 
11  #                                                                             # 
12  # relax 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 relax; if not, write to the Free Software                        # 
19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
20  #                                                                             # 
21  ############################################################################### 
22   
23  # Python module imports. 
24  from unittest import TestCase 
25   
26  # relax module imports. 
27  from data.pipe_container import PipeContainer 
28   
29   
30 -class Test_pipe_container(TestCase):
31 """Unit tests for the data.pipe_container relax module.""" 32
33 - def setUp(self):
34 """Create a data pipe structure for testing all the object methods.""" 35 36 # The initial empty structure. 37 self.data_pipe = PipeContainer()
38 39
40 - def tearDown(self):
41 """Delete the data pipe.""" 42 43 del self.data_pipe
44 45
46 - def test_PipeContainer_repr(self):
47 """Test the PipeContainer.__repr__() method.""" 48 49 # Add a few objects. 50 self.data_pipe.x = 10 51 self.data_pipe.chi2 = PipeContainer() 52 53 # Test that __repr__() returns a string. 54 self.assert_(type(self.data_pipe.__repr__()), str)
55 56
58 """Test the PipeContainer.__repr__() method for an empty data pipe.""" 59 60 # Test that __repr__() returns a string. 61 self.assert_(type(self.data_pipe.__repr__()), str)
62 63
65 """Tests for the PipeContainer.is_empty() method.""" 66 67 # The newly initialised data pipe should be empty. 68 self.assert_(self.data_pipe.is_empty()) 69 70 # Add an object. 71 self.data_pipe.x = 1 72 self.assert_(not self.data_pipe.is_empty()) 73 74 # Reset the data pipe, and modify an object. 75 self.setUp() 76 self.data_pipe.mol[0].name = 'Ap4Aase' 77 self.assert_(not self.data_pipe.is_empty()) 78 79 # The pipe type can be set in the empty data pipe. 80 self.setUp() 81 self.data_pipe.pipe_type = 'mf' 82 self.assert_(self.data_pipe.is_empty())
83