summaryrefslogtreecommitdiff
path: root/git/test
diff options
context:
space:
mode:
authorHarmon <Harmon758@gmail.com>2020-02-16 15:48:50 -0600
committerHarmon <Harmon758@gmail.com>2020-02-16 16:17:06 -0600
commitab361cfecf9c0472f9682d5d18c405bd90ddf6d7 (patch)
tree35c9e437635786509189ed4aea64f297856be8ea /git/test
parent99471bb594c365c7ad7ba99faa9e23ee78255eb9 (diff)
downloadgitpython-ab361cfecf9c0472f9682d5d18c405bd90ddf6d7.tar.gz
Replace assert_equal with assertEqual
Also change TestActor to subclass TestBase rather than object and create and use base TestCommitSerialization class for assert_commit_serialization method
Diffstat (limited to 'git/test')
-rw-r--r--git/test/lib/asserts.py3
-rw-r--r--git/test/performance/test_commit.py6
-rw-r--r--git/test/test_actor.py16
-rw-r--r--git/test/test_blob.py9
-rw-r--r--git/test/test_commit.py101
-rw-r--r--git/test/test_diff.py27
-rw-r--r--git/test/test_git.py31
-rw-r--r--git/test/test_repo.py59
-rw-r--r--git/test/test_stats.py19
-rw-r--r--git/test/test_util.py9
10 files changed, 135 insertions, 145 deletions
diff --git a/git/test/lib/asserts.py b/git/test/lib/asserts.py
index 2401e538..97b0e2e8 100644
--- a/git/test/lib/asserts.py
+++ b/git/test/lib/asserts.py
@@ -7,7 +7,6 @@
from unittest.mock import patch
from nose.tools import (
- assert_equal, # @UnusedImport
assert_not_equal, # @UnusedImport
assert_raises, # @UnusedImport
raises, # @UnusedImport
@@ -15,5 +14,5 @@ from nose.tools import (
assert_false # @UnusedImport
)
-__all__ = ['assert_equal', 'assert_not_equal', 'assert_raises', 'patch', 'raises',
+__all__ = ['assert_not_equal', 'assert_raises', 'patch', 'raises',
'assert_true', 'assert_false']
diff --git a/git/test/performance/test_commit.py b/git/test/performance/test_commit.py
index 659f320d..578194a2 100644
--- a/git/test/performance/test_commit.py
+++ b/git/test/performance/test_commit.py
@@ -11,10 +11,10 @@ import sys
from .lib import TestBigRepoRW
from git import Commit
from gitdb import IStream
-from git.test.test_commit import assert_commit_serialization
+from git.test.test_commit import TestCommitSerialization
-class TestPerformance(TestBigRepoRW):
+class TestPerformance(TestBigRepoRW, TestCommitSerialization):
def tearDown(self):
import gc
@@ -79,7 +79,7 @@ class TestPerformance(TestBigRepoRW):
% (nc, elapsed_time, nc / elapsed_time), file=sys.stderr)
def test_commit_serialization(self):
- assert_commit_serialization(self.gitrwrepo, '58c78e6', True)
+ self.assert_commit_serialization(self.gitrwrepo, '58c78e6', True)
rwrepo = self.gitrwrepo
make_object = rwrepo.odb.store
diff --git a/git/test/test_actor.py b/git/test/test_actor.py
index 9ba0aeba..010b82f6 100644
--- a/git/test/test_actor.py
+++ b/git/test/test_actor.py
@@ -4,16 +4,16 @@
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
-from git.test.lib import assert_equal
+from git.test.lib import TestBase
from git import Actor
-class TestActor(object):
+class TestActor(TestBase):
def test_from_string_should_separate_name_and_email(self):
a = Actor._from_string("Michael Trier <mtrier@example.com>")
- assert_equal("Michael Trier", a.name)
- assert_equal("mtrier@example.com", a.email)
+ self.assertEqual("Michael Trier", a.name)
+ self.assertEqual("mtrier@example.com", a.email)
# base type capabilities
assert a == a
@@ -25,13 +25,13 @@ class TestActor(object):
def test_from_string_should_handle_just_name(self):
a = Actor._from_string("Michael Trier")
- assert_equal("Michael Trier", a.name)
- assert_equal(None, a.email)
+ self.assertEqual("Michael Trier", a.name)
+ self.assertEqual(None, a.email)
def test_should_display_representation(self):
a = Actor._from_string("Michael Trier <mtrier@example.com>")
- assert_equal('<git.Actor "Michael Trier <mtrier@example.com>">', repr(a))
+ self.assertEqual('<git.Actor "Michael Trier <mtrier@example.com>">', repr(a))
def test_str_should_alias_name(self):
a = Actor._from_string("Michael Trier <mtrier@example.com>")
- assert_equal(a.name, str(a))
+ self.assertEqual(a.name, str(a))
diff --git a/git/test/test_blob.py b/git/test/test_blob.py
index 4c7f0055..88c50501 100644
--- a/git/test/test_blob.py
+++ b/git/test/test_blob.py
@@ -4,10 +4,7 @@
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
-from git.test.lib import (
- TestBase,
- assert_equal
-)
+from git.test.lib import TestBase
from git import Blob
@@ -15,11 +12,11 @@ class TestBlob(TestBase):
def test_mime_type_should_return_mime_type_for_known_types(self):
blob = Blob(self.rorepo, **{'binsha': Blob.NULL_BIN_SHA, 'path': 'foo.png'})
- assert_equal("image/png", blob.mime_type)
+ self.assertEqual("image/png", blob.mime_type)
def test_mime_type_should_return_text_plain_for_unknown_types(self):
blob = Blob(self.rorepo, **{'binsha': Blob.NULL_BIN_SHA, 'path': 'something'})
- assert_equal("text/plain", blob.mime_type)
+ self.assertEqual("text/plain", blob.mime_type)
def test_nodict(self):
self.assertRaises(AttributeError, setattr, self.rorepo.tree()['AUTHORS'], 'someattr', 2)
diff --git a/git/test/test_commit.py b/git/test/test_commit.py
index 500af4ef..e0c4dc32 100644
--- a/git/test/test_commit.py
+++ b/git/test/test_commit.py
@@ -22,7 +22,6 @@ from git.objects.util import tzoffset, utc
from git.repo.fun import touch
from git.test.lib import (
TestBase,
- assert_equal,
assert_not_equal,
with_rw_repo,
fixture_path,
@@ -34,58 +33,60 @@ from gitdb import IStream
import os.path as osp
-def assert_commit_serialization(rwrepo, commit_id, print_performance_info=False):
- """traverse all commits in the history of commit identified by commit_id and check
- if the serialization works.
- :param print_performance_info: if True, we will show how fast we are"""
- ns = 0 # num serializations
- nds = 0 # num deserializations
+class TestCommitSerialization(TestBase):
- st = time.time()
- for cm in rwrepo.commit(commit_id).traverse():
- nds += 1
+ def assert_commit_serialization(self, rwrepo, commit_id, print_performance_info=False):
+ """traverse all commits in the history of commit identified by commit_id and check
+ if the serialization works.
+ :param print_performance_info: if True, we will show how fast we are"""
+ ns = 0 # num serializations
+ nds = 0 # num deserializations
- # assert that we deserialize commits correctly, hence we get the same
- # sha on serialization
- stream = BytesIO()
- cm._serialize(stream)
- ns += 1
- streamlen = stream.tell()
- stream.seek(0)
+ st = time.time()
+ for cm in rwrepo.commit(commit_id).traverse():
+ nds += 1
- istream = rwrepo.odb.store(IStream(Commit.type, streamlen, stream))
- assert_equal(istream.hexsha, cm.hexsha.encode('ascii'))
+ # assert that we deserialize commits correctly, hence we get the same
+ # sha on serialization
+ stream = BytesIO()
+ cm._serialize(stream)
+ ns += 1
+ streamlen = stream.tell()
+ stream.seek(0)
- nc = Commit(rwrepo, Commit.NULL_BIN_SHA, cm.tree,
- cm.author, cm.authored_date, cm.author_tz_offset,
- cm.committer, cm.committed_date, cm.committer_tz_offset,
- cm.message, cm.parents, cm.encoding)
+ istream = rwrepo.odb.store(IStream(Commit.type, streamlen, stream))
+ self.assertEqual(istream.hexsha, cm.hexsha.encode('ascii'))
- assert_equal(nc.parents, cm.parents)
- stream = BytesIO()
- nc._serialize(stream)
- ns += 1
- streamlen = stream.tell()
- stream.seek(0)
+ nc = Commit(rwrepo, Commit.NULL_BIN_SHA, cm.tree,
+ cm.author, cm.authored_date, cm.author_tz_offset,
+ cm.committer, cm.committed_date, cm.committer_tz_offset,
+ cm.message, cm.parents, cm.encoding)
- # reuse istream
- istream.size = streamlen
- istream.stream = stream
- istream.binsha = None
- nc.binsha = rwrepo.odb.store(istream).binsha
+ self.assertEqual(nc.parents, cm.parents)
+ stream = BytesIO()
+ nc._serialize(stream)
+ ns += 1
+ streamlen = stream.tell()
+ stream.seek(0)
- # if it worked, we have exactly the same contents !
- assert_equal(nc.hexsha, cm.hexsha)
- # END check commits
- elapsed = time.time() - st
+ # reuse istream
+ istream.size = streamlen
+ istream.stream = stream
+ istream.binsha = None
+ nc.binsha = rwrepo.odb.store(istream).binsha
- if print_performance_info:
- print("Serialized %i and deserialized %i commits in %f s ( (%f, %f) commits / s"
- % (ns, nds, elapsed, ns / elapsed, nds / elapsed), file=sys.stderr)
- # END handle performance info
+ # if it worked, we have exactly the same contents !
+ self.assertEqual(nc.hexsha, cm.hexsha)
+ # END check commits
+ elapsed = time.time() - st
+ if print_performance_info:
+ print("Serialized %i and deserialized %i commits in %f s ( (%f, %f) commits / s"
+ % (ns, nds, elapsed, ns / elapsed, nds / elapsed), file=sys.stderr)
+ # END handle performance info
-class TestCommit(TestBase):
+
+class TestCommit(TestCommitSerialization):
def test_bake(self):
@@ -94,8 +95,8 @@ class TestCommit(TestBase):
self.assertRaises(AttributeError, setattr, commit, 'someattr', 1)
commit.author # bake
- assert_equal("Sebastian Thiel", commit.author.name)
- assert_equal("byronimo@gmail.com", commit.author.email)
+ self.assertEqual("Sebastian Thiel", commit.author.name)
+ self.assertEqual("byronimo@gmail.com", commit.author.email)
self.assertEqual(commit.author, commit.committer)
assert isinstance(commit.authored_date, int) and isinstance(commit.committed_date, int)
assert isinstance(commit.author_tz_offset, int) and isinstance(commit.committer_tz_offset, int)
@@ -220,7 +221,7 @@ class TestCommit(TestBase):
'933d23bf95a5bd1624fbcdf328d904e1fa173474'
)
for sha1, commit in zip(expected_ids, commits):
- assert_equal(sha1, commit.hexsha)
+ self.assertEqual(sha1, commit.hexsha)
@with_rw_directory
def test_ambiguous_arg_iteration(self, rw_dir):
@@ -242,17 +243,17 @@ class TestCommit(TestBase):
def test_str(self):
commit = Commit(self.rorepo, Commit.NULL_BIN_SHA)
- assert_equal(Commit.NULL_HEX_SHA, str(commit))
+ self.assertEqual(Commit.NULL_HEX_SHA, str(commit))
def test_repr(self):
commit = Commit(self.rorepo, Commit.NULL_BIN_SHA)
- assert_equal('<git.Commit "%s">' % Commit.NULL_HEX_SHA, repr(commit))
+ self.assertEqual('<git.Commit "%s">' % Commit.NULL_HEX_SHA, repr(commit))
def test_equality(self):
commit1 = Commit(self.rorepo, Commit.NULL_BIN_SHA)
commit2 = Commit(self.rorepo, Commit.NULL_BIN_SHA)
commit3 = Commit(self.rorepo, "\1" * 20)
- assert_equal(commit1, commit2)
+ self.assertEqual(commit1, commit2)
assert_not_equal(commit2, commit3)
def test_iter_parents(self):
@@ -272,7 +273,7 @@ class TestCommit(TestBase):
@with_rw_repo('HEAD', bare=True)
def test_serialization(self, rwrepo):
# create all commits of our repo
- assert_commit_serialization(rwrepo, '0.1.6')
+ self.assert_commit_serialization(rwrepo, '0.1.6')
def test_serialization_unicode_support(self):
self.assertEqual(Commit.default_encoding.lower(), 'utf-8')
diff --git a/git/test/test_diff.py b/git/test/test_diff.py
index e4e7556d..fe41fc52 100644
--- a/git/test/test_diff.py
+++ b/git/test/test_diff.py
@@ -20,7 +20,6 @@ from git.test.lib import (
TestBase,
StringProcessAdapter,
fixture,
- assert_equal,
assert_true,
)
from git.test.lib import with_rw_directory
@@ -95,23 +94,23 @@ class TestDiff(TestBase):
diffs = Diff._index_from_patch_format(self.rorepo, output)
self._assert_diff_format(diffs)
- assert_equal(1, len(diffs))
- assert_equal(8, len(diffs[0].diff.splitlines()))
+ self.assertEqual(1, len(diffs))
+ self.assertEqual(8, len(diffs[0].diff.splitlines()))
def test_diff_with_rename(self):
output = StringProcessAdapter(fixture('diff_rename'))
diffs = Diff._index_from_patch_format(self.rorepo, output)
self._assert_diff_format(diffs)
- assert_equal(1, len(diffs))
+ self.assertEqual(1, len(diffs))
diff = diffs[0]
assert_true(diff.renamed_file)
assert_true(diff.renamed)
- assert_equal(diff.rename_from, u'Jérôme')
- assert_equal(diff.rename_to, u'müller')
- assert_equal(diff.raw_rename_from, b'J\xc3\xa9r\xc3\xb4me')
- assert_equal(diff.raw_rename_to, b'm\xc3\xbcller')
+ self.assertEqual(diff.rename_from, u'Jérôme')
+ self.assertEqual(diff.rename_to, u'müller')
+ self.assertEqual(diff.raw_rename_from, b'J\xc3\xa9r\xc3\xb4me')
+ self.assertEqual(diff.raw_rename_to, b'm\xc3\xbcller')
assert isinstance(str(diff), str)
output = StringProcessAdapter(fixture('diff_rename_raw'))
@@ -131,7 +130,7 @@ class TestDiff(TestBase):
diffs = Diff._index_from_patch_format(self.rorepo, output)
self._assert_diff_format(diffs)
- assert_equal(1, len(diffs))
+ self.assertEqual(1, len(diffs))
diff = diffs[0]
assert_true(diff.copied_file)
@@ -153,17 +152,17 @@ class TestDiff(TestBase):
output = StringProcessAdapter(fixture('diff_change_in_type'))
diffs = Diff._index_from_patch_format(self.rorepo, output)
self._assert_diff_format(diffs)
- assert_equal(2, len(diffs))
+ self.assertEqual(2, len(diffs))
diff = diffs[0]
self.assertIsNotNone(diff.deleted_file)
- assert_equal(diff.a_path, 'this')
- assert_equal(diff.b_path, 'this')
+ self.assertEqual(diff.a_path, 'this')
+ self.assertEqual(diff.b_path, 'this')
assert isinstance(str(diff), str)
diff = diffs[1]
- assert_equal(diff.a_path, None)
- assert_equal(diff.b_path, 'this')
+ self.assertEqual(diff.a_path, None)
+ self.assertEqual(diff.b_path, 'this')
self.assertIsNotNone(diff.new_file)
assert isinstance(str(diff), str)
diff --git a/git/test/test_git.py b/git/test/test_git.py
index 2be39fce..ccee5f3c 100644
--- a/git/test/test_git.py
+++ b/git/test/test_git.py
@@ -23,7 +23,6 @@ from git.test.lib import (
TestBase,
patch,
raises,
- assert_equal,
assert_true,
fixture_path
)
@@ -51,35 +50,35 @@ class TestGit(TestBase):
git.return_value = ''
self.git.version()
assert_true(git.called)
- assert_equal(git.call_args, ((['git', 'version'],), {}))
+ self.assertEqual(git.call_args, ((['git', 'version'],), {}))
def test_call_unpack_args_unicode(self):
args = Git._Git__unpack_args(u'Unicode€™')
mangled_value = 'Unicode\u20ac\u2122'
- assert_equal(args, [mangled_value])
+ self.assertEqual(args, [mangled_value])
def test_call_unpack_args(self):
args = Git._Git__unpack_args(['git', 'log', '--', u'Unicode€™'])
mangled_value = 'Unicode\u20ac\u2122'
- assert_equal(args, ['git', 'log', '--', mangled_value])
+ self.assertEqual(args, ['git', 'log', '--', mangled_value])
@raises(GitCommandError)
def test_it_raises_errors(self):
self.git.this_does_not_exist()
def test_it_transforms_kwargs_into_git_command_arguments(self):
- assert_equal(["-s"], self.git.transform_kwargs(**{'s': True}))
- assert_equal(["-s", "5"], self.git.transform_kwargs(**{'s': 5}))
- assert_equal([], self.git.transform_kwargs(**{'s': None}))
+ self.assertEqual(["-s"], self.git.transform_kwargs(**{'s': True}))
+ self.assertEqual(["-s", "5"], self.git.transform_kwargs(**{'s': 5}))
+ self.assertEqual([], self.git.transform_kwargs(**{'s': None}))
- assert_equal(["--max-count"], self.git.transform_kwargs(**{'max_count': True}))
- assert_equal(["--max-count=5"], self.git.transform_kwargs(**{'max_count': 5}))
- assert_equal(["--max-count=0"], self.git.transform_kwargs(**{'max_count': 0}))
- assert_equal([], self.git.transform_kwargs(**{'max_count': None}))
+ self.assertEqual(["--max-count"], self.git.transform_kwargs(**{'max_count': True}))
+ self.assertEqual(["--max-count=5"], self.git.transform_kwargs(**{'max_count': 5}))
+ self.assertEqual(["--max-count=0"], self.git.transform_kwargs(**{'max_count': 0}))
+ self.assertEqual([], self.git.transform_kwargs(**{'max_count': None}))
# Multiple args are supported by using lists/tuples
- assert_equal(["-L", "1-3", "-L", "12-18"], self.git.transform_kwargs(**{'L': ('1-3', '12-18')}))
- assert_equal(["-C", "-C"], self.git.transform_kwargs(**{'C': [True, True, None, False]}))
+ self.assertEqual(["-L", "1-3", "-L", "12-18"], self.git.transform_kwargs(**{'L': ('1-3', '12-18')}))
+ self.assertEqual(["-C", "-C"], self.git.transform_kwargs(**{'C': [True, True, None, False]}))
# order is undefined
res = self.git.transform_kwargs(**{'s': True, 't': True})
@@ -91,8 +90,8 @@ class TestGit(TestBase):
def test_it_accepts_stdin(self):
filename = fixture_path("cat_file_blob")
with open(filename, 'r') as fh:
- assert_equal("70c379b63ffa0795fdbfbc128e5a2818397b7ef8",
- self.git.hash_object(istream=fh, stdin=True))
+ self.assertEqual("70c379b63ffa0795fdbfbc128e5a2818397b7ef8",
+ self.git.hash_object(istream=fh, stdin=True))
@patch.object(Git, 'execute')
def test_it_ignores_false_kwargs(self, git):
@@ -118,7 +117,7 @@ class TestGit(TestBase):
'GIT_COMMITTER_DATE': '1500000000+0000',
}
commit = self.git.commit_tree(tree, m='message', env=env)
- assert_equal(commit, '4cfd6b0314682d5a58f80be39850bad1640e9241')
+ self.assertEqual(commit, '4cfd6b0314682d5a58f80be39850bad1640e9241')
def test_persistent_cat_file_command(self):
# read header only
diff --git a/git/test/test_repo.py b/git/test/test_repo.py
index 0cbdbe0e..c37fd744 100644
--- a/git/test/test_repo.py
+++ b/git/test/test_repo.py
@@ -42,7 +42,6 @@ from git.test.lib import (
with_rw_repo,
fixture,
assert_false,
- assert_equal,
assert_true,
raises
)
@@ -107,11 +106,11 @@ class TestRepo(TestBase):
def test_description(self):
txt = "Test repository"
self.rorepo.description = txt
- assert_equal(self.rorepo.description, txt)
+ self.assertEqual(self.rorepo.description, txt)
def test_heads_should_return_array_of_head_objects(self):
for head in self.rorepo.heads:
- assert_equal(Head, head.__class__)
+ self.assertEqual(Head, head.__class__)
def test_heads_should_populate_head_data(self):
for head in self.rorepo.heads:
@@ -145,18 +144,18 @@ class TestRepo(TestBase):
self.assertEqual(len(commits), mc)
c = commits[0]
- assert_equal('9a4b1d4d11eee3c5362a4152216376e634bd14cf', c.hexsha)
- assert_equal(["c76852d0bff115720af3f27acdb084c59361e5f6"], [p.hexsha for p in c.parents])
- assert_equal("ce41fc29549042f1aa09cc03174896cf23f112e3", c.tree.hexsha)
- assert_equal("Michael Trier", c.author.name)
- assert_equal("mtrier@gmail.com", c.author.email)
- assert_equal(1232829715, c.authored_date)
- assert_equal(5 * 3600, c.author_tz_offset)
- assert_equal("Michael Trier", c.committer.name)
- assert_equal("mtrier@gmail.com", c.committer.email)
- assert_equal(1232829715, c.committed_date)
- assert_equal(5 * 3600, c.committer_tz_offset)
- assert_equal("Bumped version 0.1.6\n", c.message)
+ self.assertEqual('9a4b1d4d11eee3c5362a4152216376e634bd14cf', c.hexsha)
+ self.assertEqual(["c76852d0bff115720af3f27acdb084c59361e5f6"], [p.hexsha for p in c.parents])
+ self.assertEqual("ce41fc29549042f1aa09cc03174896cf23f112e3", c.tree.hexsha)
+ self.assertEqual("Michael Trier", c.author.name)
+ self.assertEqual("mtrier@gmail.com", c.author.email)
+ self.assertEqual(1232829715, c.authored_date)
+ self.assertEqual(5 * 3600, c.author_tz_offset)
+ self.assertEqual("Michael Trier", c.committer.name)
+ self.assertEqual("mtrier@gmail.com", c.committer.email)
+ self.assertEqual(1232829715, c.committed_date)
+ self.assertEqual(5 * 3600, c.committer_tz_offset)
+ self.assertEqual("Bumped version 0.1.6\n", c.message)
c = commits[1]
self.assertIsInstance(c.parents, tuple)
@@ -204,7 +203,7 @@ class TestRepo(TestBase):
cloned = Repo.clone_from(original_repo.git_dir, osp.join(rw_dir, "clone"), env=environment)
- assert_equal(environment, cloned.git.environment())
+ self.assertEqual(environment, cloned.git.environment())
@with_rw_directory
def test_date_format(self, rw_dir):
@@ -227,9 +226,9 @@ class TestRepo(TestBase):
"--config core.filemode=false",
"--config submodule.repo.update=checkout"])
- assert_equal(cloned.config_reader().get_value('submodule', 'active'), 'repo')
- assert_equal(cloned.config_reader().get_value('core', 'filemode'), False)
- assert_equal(cloned.config_reader().get_value('submodule "repo"', 'update'), 'checkout')
+ self.assertEqual(cloned.config_reader().get_value('submodule', 'active'), 'repo')
+ self.assertEqual(cloned.config_reader().get_value('core', 'filemode'), False)
+ self.assertEqual(cloned.config_reader().get_value('submodule "repo"', 'update'), 'checkout')
def test_clone_from_with_path_contains_unicode(self):
with tempfile.TemporaryDirectory() as tmpdir:
@@ -403,20 +402,20 @@ class TestRepo(TestBase):
def test_should_display_blame_information(self, git):
git.return_value = fixture('blame')
b = self.rorepo.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]))
+ self.assertEqual(13, len(b))
+ self.assertEqual(2, len(b[0]))
+ # self.assertEqual(25, reduce(lambda acc, x: acc + len(x[-1]), b))
+ self.assertEqual(hash(b[0][0]), hash(b[9][0]))
c = b[0][0]
assert_true(git.called)
- assert_equal('634396b2f541a9f2d58b00be1a07f0c358b999b3', c.hexsha)
- assert_equal('Tom Preston-Werner', c.author.name)
- assert_equal('tom@mojombo.com', c.author.email)
- assert_equal(1191997100, c.authored_date)
- assert_equal('Tom Preston-Werner', c.committer.name)
- assert_equal('tom@mojombo.com', c.committer.email)
- assert_equal(1191997100, c.committed_date)
+ self.assertEqual('634396b2f541a9f2d58b00be1a07f0c358b999b3', c.hexsha)
+ self.assertEqual('Tom Preston-Werner', c.author.name)
+ self.assertEqual('tom@mojombo.com', c.author.email)
+ self.assertEqual(1191997100, c.authored_date)
+ self.assertEqual('Tom Preston-Werner', c.committer.name)
+ self.assertEqual('tom@mojombo.com', c.committer.email)
+ self.assertEqual(1191997100, c.committed_date)
self.assertRaisesRegex(ValueError, "634396b2f541a9f2d58b00be1a07f0c358b999b3 missing", lambda: c.message)
# test the 'lines per commit' entries
diff --git a/git/test/test_stats.py b/git/test/test_stats.py
index 884ab1ab..92f5c8aa 100644
--- a/git/test/test_stats.py
+++ b/git/test/test_stats.py
@@ -6,8 +6,7 @@
from git.test.lib import (
TestBase,
- fixture,
- assert_equal
+ fixture
)
from git import Stats
from git.compat import defenc
@@ -19,13 +18,13 @@ class TestStats(TestBase):
output = fixture('diff_numstat').decode(defenc)
stats = Stats._list_from_string(self.rorepo, output)
- assert_equal(2, stats.total['files'])
- assert_equal(52, stats.total['lines'])
- assert_equal(29, stats.total['insertions'])
- assert_equal(23, stats.total['deletions'])
+ self.assertEqual(2, stats.total['files'])
+ self.assertEqual(52, stats.total['lines'])
+ self.assertEqual(29, stats.total['insertions'])
+ self.assertEqual(23, stats.total['deletions'])
- assert_equal(29, stats.files["a.txt"]['insertions'])
- assert_equal(18, stats.files["a.txt"]['deletions'])
+ self.assertEqual(29, stats.files["a.txt"]['insertions'])
+ self.assertEqual(18, stats.files["a.txt"]['deletions'])
- assert_equal(0, stats.files["b.txt"]['insertions'])
- assert_equal(5, stats.files["b.txt"]['deletions'])
+ self.assertEqual(0, stats.files["b.txt"]['insertions'])
+ self.assertEqual(5, stats.files["b.txt"]['deletions'])
diff --git a/git/test/test_util.py b/git/test/test_util.py
index 1560affb..77fbdeb9 100644
--- a/git/test/test_util.py
+++ b/git/test/test_util.py
@@ -21,10 +21,7 @@ from git.objects.util import (
parse_date,
tzoffset,
from_timestamp)
-from git.test.lib import (
- TestBase,
- assert_equal
-)
+from git.test.lib import TestBase
from git.util import (
LockFile,
BlockingLockFile,
@@ -126,8 +123,8 @@ class TestUtils(TestBase):
self.assertEqual(wcpath, wpath.replace('/', '\\'), cpath)
def test_it_should_dashify(self):
- assert_equal('this-is-my-argument', dashify('this_is_my_argument'))
- assert_equal('foo', dashify('foo'))
+ self.assertEqual('this-is-my-argument', dashify('this_is_my_argument'))
+ self.assertEqual('foo', dashify('foo'))
def test_lock_file(self):
my_file = tempfile.mktemp()