/[thuban]/branches/WIP-pyshapelib-bramz/test/test_fileutil.py
ViewVC logotype

Annotation of /branches/WIP-pyshapelib-bramz/test/test_fileutil.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2734 - (hide annotations)
Thu Mar 1 12:42:59 2007 UTC (18 years ago) by bramz
File MIME type: text/x-python
File size: 2564 byte(s)
made a copy
1 bh 340 # Copyright (c) 2002 by Intevation GmbH
2     # Authors:
3     # Bernhard Herzog <[email protected]>
4     #
5     # This program is free software under the GPL (>=v2)
6     # Read the file COPYING coming with Thuban for details.
7    
8     """
9     Test the functions in Thuban.Lib.fileutil
10     """
11    
12     __version__ = "$Revision$"
13     # $Source$
14     # $Id$
15    
16     import unittest
17    
18     import support
19     support.initthuban()
20    
21     from Thuban.Lib.fileutil import relative_filename_posix, relative_filename_nt
22    
23     class TestRelativeFilename(unittest.TestCase):
24    
25     """Test cases for the relative_filename function."""
26    
27     def test_posix(self):
28     """Test relative_filename posix version"""
29     self.assertEquals(relative_filename_posix("/usr/local/lib/",
30     "/usr/local/lib/python"),
31     'python')
32     self.assertEquals(relative_filename_posix("/usr/local/lib/",
33     "/usr/local/bin/python"),
34     '../bin/python')
35     self.assertEquals(relative_filename_posix("/usr/local/lib/",
36     "/usr/bin/python"),
37     '../../bin/python')
38     self.assertEquals(relative_filename_posix("/usr/local/lib/",
39     "/var/spool/mail"),
40     '/var/spool/mail')
41     self.assertEquals(relative_filename_posix("/home/", "xyzzy"),
42     'xyzzy')
43     self.assertRaises(TypeError,
44     relative_filename_posix, "home/", "/xyzzy")
45    
46     def test_nt(self):
47     """Test relative_filename nt version"""
48     self.assertEquals(relative_filename_nt(r"C:\Programme\Python",
49     r"C:\Programme\Thuban"),
50     '..\\Thuban')
51     self.assertEquals(relative_filename_nt(r"C:\Programme\Python",
52     r"D:\Programme\Thuban"),
53     'D:\\Programme\\Thuban')
54     self.assertEquals(relative_filename_nt(r"C:\Programme\Python",
55     r"C:Programme"),
56     'C:Programme')
57     # first argument is not an absolute filename
58     self.assertRaises(TypeError, relative_filename_nt,
59     r"C:Programme\Python", r"C:Programme")
60     # No drive letters
61     self.assertRaises(TypeError, relative_filename_nt,
62     r"\Programme\Python", r"\Programme")
63    
64    
65     if __name__ == "__main__":
66     unittest.main()
67    

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26