1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 from os import sep
24 from unittest import TestCase
25
26
27 import relax_io
28
29
31 """Unit tests for the functions of the 'relax_io' module."""
32
33
35 """Test for file paths which should remain unmodified by relax_io.get_file_path."""
36
37
38 file1 = 'test'
39 file2 = 'test'+sep+'aaa'
40 file3 = sep+'home'+sep+'test'+sep+'aaa'
41
42
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
52 file1 = 'test'
53 file2 = 'test'+sep+'aaa'
54 file3 = sep+'home'+sep+'test'+sep+'aaa'
55
56
57 dir1 = sep+'usr'
58 dir2 = 'usr'
59 dir3 = sep+'usr'
60
61
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
71 file1 = '~'+sep+'test'
72 file2 = '~'+sep+'test'+sep+'aaa'
73
74
75 self.assertNotEqual(relax_io.get_file_path(file1), file1)
76 self.assertNotEqual(relax_io.get_file_path(file2), file2)
77