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

Source Code for Module test_suite.unit_tests.test_relax_io

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2007 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 os import sep 
24  from unittest import TestCase 
25   
26  # relax module imports. 
27  import relax_io 
28   
29   
30 -class Test_relax_io(TestCase):
31 """Unit tests for the functions of the 'relax_io' module.""" 32 33
34 - def test_get_file_path(self):
35 """Test for file paths which should remain unmodified by relax_io.get_file_path.""" 36 37 # Some file paths that shouldn't change. 38 file1 = 'test' 39 file2 = 'test'+sep+'aaa' 40 file3 = sep+'home'+sep+'test'+sep+'aaa' 41 42 # Check that nothing changes. 43 self.assertEqual(relax_io.get_file_path(file1), file1) 44 self.assertEqual(relax_io.get_file_path(file2), file2) 45 self.assertEqual(relax_io.get_file_path(file3), file3)
46 47
49 """The modification of file paths by relax_io.get_file_path when a directory is supplied.""" 50 51 # Some file paths. 52 file1 = 'test' 53 file2 = 'test'+sep+'aaa' 54 file3 = sep+'home'+sep+'test'+sep+'aaa' 55 56 # Some directories. 57 dir1 = sep+'usr' 58 dir2 = 'usr' 59 dir3 = sep+'usr' 60 61 # Check that nothing changes. 62 self.assertEqual(relax_io.get_file_path(file1, dir1), dir1+sep+file1) 63 self.assertEqual(relax_io.get_file_path(file2, dir2), dir2+sep+file2) 64 self.assertEqual(relax_io.get_file_path(file3, dir=dir3), dir3+sep+file3)
65 66
68 """The modification of file paths with '~', by relax_io.get_file_path.""" 69 70 # Some file paths. 71 file1 = '~'+sep+'test' 72 file2 = '~'+sep+'test'+sep+'aaa' 73 74 # Check that nothing changes. 75 self.assertNotEqual(relax_io.get_file_path(file1), file1) 76 self.assertNotEqual(relax_io.get_file_path(file2), file2)
77