summaryrefslogtreecommitdiff
path: root/fs/tests
diff options
context:
space:
mode:
authorwillmcgugan@gmail.com <willmcgugan@gmail.com@67cdc799-7952-0410-af00-57a81ceafa0f>2013-06-28 12:28:08 +0000
committerwillmcgugan@gmail.com <willmcgugan@gmail.com@67cdc799-7952-0410-af00-57a81ceafa0f>2013-06-28 12:28:08 +0000
commit9545ff3d5e3605d2c70a67a2de9607bd34d08014 (patch)
tree62afbfcd04de8b294a49d3801cae150a7ee86b30 /fs/tests
parent8a78d3236747fc2602eff9e307ff938607a14444 (diff)
downloadpyfilesystem-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.py15
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):