diff options
author | willmcgugan@gmail.com <willmcgugan@gmail.com@67cdc799-7952-0410-af00-57a81ceafa0f> | 2013-06-28 12:28:08 +0000 |
---|---|---|
committer | willmcgugan@gmail.com <willmcgugan@gmail.com@67cdc799-7952-0410-af00-57a81ceafa0f> | 2013-06-28 12:28:08 +0000 |
commit | 9545ff3d5e3605d2c70a67a2de9607bd34d08014 (patch) | |
tree | 62afbfcd04de8b294a49d3801cae150a7ee86b30 /fs/tests | |
parent | 8a78d3236747fc2602eff9e307ff938607a14444 (diff) | |
download | pyfilesystem-9545ff3d5e3605d2c70a67a2de9607bd34d08014.tar.gz |
Added 'relativefrom' method to path.py
git-svn-id: http://pyfilesystem.googlecode.com/svn/trunk@857 67cdc799-7952-0410-af00-57a81ceafa0f
Diffstat (limited to 'fs/tests')
-rw-r--r-- | fs/tests/test_path.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/tests/test_path.py b/fs/tests/test_path.py index dc023a3..117fdae 100644 --- a/fs/tests/test_path.py +++ b/fs/tests/test_path.py @@ -150,6 +150,21 @@ class TestPathFunctions(unittest.TestCase): self.assertFalse(iswildcard('img.jpg')) self.assertFalse(iswildcard('foo/bar')) + def test_realtivefrom(self): + tests = [('/', '/foo.html', 'foo.html'), + ('/foo', '/foo/bar.html', 'bar.html'), + ('/foo/bar/', '/egg.html', '../../egg.html'), + ('/a/b/c/d', 'e', '../../../../e'), + ('/a/b/c/d', 'a/d', '../../../d'), + ('/docs/', 'tags/index.html', '../tags/index.html'), + ('foo/bar', 'baz/index.html', '../../baz/index.html'), + ('', 'a', 'a'), + ('a', 'b/c', '../b/c') + ] + + for base, path, result in tests: + self.assertEqual(relativefrom(base, path), result) + class Test_PathMap(unittest.TestCase): |