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