From c4cde8df886112ee32b0a09fcac90c28c85ded7f Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 4 Nov 2009 12:46:37 +0100 Subject: IndexObject: assured that .path fields are relative to the repository ( previously it would just be a name ) added abspath property and name property to provide easy access to most common paths of an index object --- test/git/test_tree.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/git/test_tree.py') diff --git a/test/git/test_tree.py b/test/git/test_tree.py index 64a7900a..7b66743f 100644 --- a/test/git/test_tree.py +++ b/test/git/test_tree.py @@ -4,6 +4,7 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php +import os from test.testlib import * from git import * @@ -43,6 +44,19 @@ class TestTree(TestCase): # trees and blobs assert len(set(trees)|set(root.trees)) == len(trees) assert len(set(b for b in root if isinstance(b, Blob)) | set(root.blobs)) == len( root.blobs ) + subitem = trees[0][0] + assert "/" in subitem.path + assert subitem.name == os.path.basename(subitem.path) + + # assure that at some point the traversed paths have a slash in them + found_slash = False + for item in root.traverse(): + assert os.path.isabs(item.abspath) + if '/' in item.path: + found_slash = True + break + # END for each item + assert found_slash def test_repr(self): tree = Tree(self.repo, 'abc') -- cgit v1.2.1