Package test_suite :: Package unit_tests :: Package _generic_fns :: Module test_relax_re
[hide private]
[frames] | no frames]

Source Code for Module test_suite.unit_tests._generic_fns.test_relax_re

 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 generic_fns import relax_re 
28   
29   
30 -class Test_relax_re(TestCase):
31 """Unit tests for the functions of the 'generic_fns.relax_re' module.""" 32 33 # Place the generic_fns.relax_re module into the class namespace. 34 relax_re_fns = relax_re 35 36
37 - def test_search(self):
38 """Test the proper behaviour of the generic_fns.relax_re.search() function.""" 39 40 # Test a number of calls which should return True. 41 self.assertTrue(self.relax_re_fns.search('H', 'H')) 42 self.assertTrue(self.relax_re_fns.search('H*', 'H')) 43 self.assertTrue(self.relax_re_fns.search('H*', 'H1')) 44 self.assertTrue(self.relax_re_fns.search('H1', 'H1')) 45 self.assertTrue(self.relax_re_fns.search('^H*', 'H')) 46 self.assertTrue(self.relax_re_fns.search('^H*$', 'H')) 47 self.assertTrue(self.relax_re_fns.search('^H*$', 'H')) 48 49 # Test a number of calls which should return False. 50 self.assertFalse(self.relax_re_fns.search('H*', 'NH')) 51 self.assertFalse(self.relax_re_fns.search('H', 'HN')) 52 self.assertFalse(self.relax_re_fns.search('H', 'H1'))
53