summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2009-10-12 11:50:14 +0200
committerSebastian Thiel <byronimo@gmail.com>2009-10-12 11:50:14 +0200
commitf2834177c0fdf6b1af659e460fd3348f468b8ab0 (patch)
tree2cb12187e664a026974383ed303cf307df2d4029 /test
parent3c0a65226f038c58fc6d6ed525f38fc00b3579b7 (diff)
downloadgitpython-f2834177c0fdf6b1af659e460fd3348f468b8ab0.tar.gz
Reorganized package structure and cleaned up imports
Diffstat (limited to 'test')
-rw-r--r--test/git/test_base.py12
-rw-r--r--test/git/test_blob.py28
-rw-r--r--test/git/test_repo.py27
-rw-r--r--test/git/test_tag.py2
4 files changed, 35 insertions, 34 deletions
diff --git a/test/git/test_base.py b/test/git/test_base.py
index 8f522cec..a153eb83 100644
--- a/test/git/test_base.py
+++ b/test/git/test_base.py
@@ -7,8 +7,10 @@
import time
from test.testlib import *
from git import *
-import git.base as base
+import git.objects.base as base
+import git.refs as refs
from itertools import chain
+from git.objects.util import get_object_type_by_name
class TestBase(object):
@@ -60,7 +62,7 @@ class TestBase(object):
ref_count = 0
for ref in chain(self.repo.tags, self.repo.heads):
ref_count += 1
- assert isinstance(ref, base.Ref)
+ assert isinstance(ref, refs.Ref)
assert str(ref) == ref.name
assert repr(ref)
assert ref == ref
@@ -69,10 +71,10 @@ class TestBase(object):
# END for each ref
assert len(s) == ref_count
- def test_get_type_by_name(self):
+ def test_get_object_type_by_name(self):
for tname in base.Object.TYPES:
- assert base.Object in base.Object.get_type_by_name(tname).mro()
+ assert base.Object in get_object_type_by_name(tname).mro()
# END for each known type
- assert_raises( ValueError, base.Object.get_type_by_name, "doesntexist" )
+ assert_raises( ValueError, get_object_type_by_name, "doesntexist" )
diff --git a/test/git/test_blob.py b/test/git/test_blob.py
index 94d3a33b..ebb53d0c 100644
--- a/test/git/test_blob.py
+++ b/test/git/test_blob.py
@@ -65,34 +65,6 @@ class TestBlob(object):
blob = Blob(self.repo, **{'id': 'abc','path': 'something'})
assert_equal("text/plain", blob.mime_type)
- @patch_object(Git, '_call_process')
- def test_should_display_blame_information(self, git):
- git.return_value = fixture('blame')
- b = Blob.blame(self.repo, 'master', 'lib/git.py')
- assert_equal(13, len(b))
- assert_equal( 2, len(b[0]) )
- # assert_equal(25, reduce(lambda acc, x: acc + len(x[-1]), b))
- assert_equal(hash(b[0][0]), hash(b[9][0]))
- c = b[0][0]
- assert_true(git.called)
- assert_equal(git.call_args, (('blame', 'master', '--', 'lib/git.py'), {'p': True}))
-
- assert_equal('634396b2f541a9f2d58b00be1a07f0c358b999b3', c.id)
- assert_equal('Tom Preston-Werner', c.author.name)
- assert_equal('tom@mojombo.com', c.author.email)
- assert_equal(time.gmtime(1191997100), c.authored_date)
- assert_equal('Tom Preston-Werner', c.committer.name)
- assert_equal('tom@mojombo.com', c.committer.email)
- assert_equal(time.gmtime(1191997100), c.committed_date)
- assert_equal('initial grit setup', c.message)
-
- # test the 'lines per commit' entries
- tlist = b[0][1]
- assert_true( tlist )
- assert_true( isinstance( tlist[0], basestring ) )
- assert_true( len( tlist ) < sum( len(t) for t in tlist ) ) # test for single-char bug
-
-
def test_should_return_appropriate_representation(self):
blob = Blob(self.repo, **{'id': 'abc'})
assert_equal('<git.Blob "abc">', repr(blob))
diff --git a/test/git/test_repo.py b/test/git/test_repo.py
index 421b8256..3e2fb3dc 100644
--- a/test/git/test_repo.py
+++ b/test/git/test_repo.py
@@ -257,3 +257,30 @@ class TestRepo(object):
git.return_value = 'refs/heads/major-refactoring'
assert_equal(self.repo.active_branch, 'major-refactoring')
assert_equal(git.call_args, (('symbolic_ref', 'HEAD'), {}))
+
+ @patch_object(Git, '_call_process')
+ def test_should_display_blame_information(self, git):
+ git.return_value = fixture('blame')
+ b = self.repo.blame( 'master', 'lib/git.py')
+ assert_equal(13, len(b))
+ assert_equal( 2, len(b[0]) )
+ # assert_equal(25, reduce(lambda acc, x: acc + len(x[-1]), b))
+ assert_equal(hash(b[0][0]), hash(b[9][0]))
+ c = b[0][0]
+ assert_true(git.called)
+ assert_equal(git.call_args, (('blame', 'master', '--', 'lib/git.py'), {'p': True}))
+
+ assert_equal('634396b2f541a9f2d58b00be1a07f0c358b999b3', c.id)
+ assert_equal('Tom Preston-Werner', c.author.name)
+ assert_equal('tom@mojombo.com', c.author.email)
+ assert_equal(time.gmtime(1191997100), c.authored_date)
+ assert_equal('Tom Preston-Werner', c.committer.name)
+ assert_equal('tom@mojombo.com', c.committer.email)
+ assert_equal(time.gmtime(1191997100), c.committed_date)
+ assert_equal('initial grit setup', c.message)
+
+ # test the 'lines per commit' entries
+ tlist = b[0][1]
+ assert_true( tlist )
+ assert_true( isinstance( tlist[0], basestring ) )
+ assert_true( len( tlist ) < sum( len(t) for t in tlist ) ) # test for single-char bug
diff --git a/test/git/test_tag.py b/test/git/test_tag.py
index fe3f78cc..2ebb860a 100644
--- a/test/git/test_tag.py
+++ b/test/git/test_tag.py
@@ -7,7 +7,7 @@
from mock import *
from test.testlib import *
from git import *
-from git.tag import TagObject
+from git.objects.tag import TagObject
import time
class TestTag(object):