Skip to content

Commit

Permalink
Use assertEqual rather than assertEquals as the latter is deprecated.
Browse files Browse the repository at this point in the history
  • Loading branch information
garyvdm committed May 24, 2014
1 parent 6deecb5 commit f642d34
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 60 deletions.
2 changes: 1 addition & 1 deletion dulwich/tests/compat/server_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_push_to_dulwich_remove_branch(self):
run_git_or_fail(['push', self.url(port), ":master"],
cwd=self._new_repo.path)

self.assertEquals(
self.assertEqual(
self._old_repo.get_refs().keys(), ["refs/heads/branch"])

def test_fetch_from_dulwich(self):
Expand Down
12 changes: 6 additions & 6 deletions dulwich/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,12 +529,12 @@ def test_connect(self):
client.port = 1337

client._connect("command", "/path/to/repo")
self.assertEquals("username", server.username)
self.assertEquals(1337, server.port)
self.assertEquals(["git-command '/path/to/repo'"], server.command)
self.assertEqual("username", server.username)
self.assertEqual(1337, server.port)
self.assertEqual(["git-command '/path/to/repo'"], server.command)

client._connect("relative-command", "/~/path/to/repo")
self.assertEquals(["git-relative-command '~/path/to/repo'"],
self.assertEqual(["git-relative-command '~/path/to/repo'"],
server.command)


Expand Down Expand Up @@ -568,7 +568,7 @@ def test_fetch_into_empty(self):
c = LocalGitClient()
t = MemoryRepo()
s = open_repo('a.git')
self.assertEquals(s.get_refs(), c.fetch(s.path, t))
self.assertEqual(s.get_refs(), c.fetch(s.path, t))

def test_fetch_empty(self):
c = LocalGitClient()
Expand All @@ -577,7 +577,7 @@ def test_fetch_empty(self):
walker = {}
c.fetch_pack(s.path, lambda heads: [], graph_walker=walker,
pack_data=out.write)
self.assertEquals("PACK\x00\x00\x00\x02\x00\x00\x00\x00\x02\x9d\x08"
self.assertEqual("PACK\x00\x00\x00\x02\x00\x00\x00\x00\x02\x9d\x08"
"\x82;\xd8\xa8\xea\xb5\x10\xadj\xc7\\\x82<\xfd>\xd3\x1e", out.getvalue())

def test_fetch_pack_none(self):
Expand Down
2 changes: 1 addition & 1 deletion dulwich/tests/test_fastexport.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def test_reset_handler(self):
[c1] = build_commit_graph(self.repo.object_store, [[1]])
cmd = commands.ResetCommand("refs/heads/foo", c1.id)
self.processor.reset_handler(cmd)
self.assertEquals(c1.id, self.repo.get_refs()["refs/heads/foo"])
self.assertEqual(c1.id, self.repo.get_refs()["refs/heads/foo"])

def test_commit_handler(self):
from fastimport import commands
Expand Down
20 changes: 10 additions & 10 deletions dulwich/tests/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,17 @@ def test_override_mode(self):
class BuildIndexTests(TestCase):

def assertReasonableIndexEntry(self, index_entry, mode, filesize, sha):
self.assertEquals(index_entry[4], mode) # mode
self.assertEquals(index_entry[7], filesize) # filesize
self.assertEquals(index_entry[8], sha) # sha
self.assertEqual(index_entry[4], mode) # mode
self.assertEqual(index_entry[7], filesize) # filesize
self.assertEqual(index_entry[8], sha) # sha

def assertFileContents(self, path, contents, symlink=False):
if symlink:
self.assertEquals(os.readlink(path), contents)
self.assertEqual(os.readlink(path), contents)
else:
f = open(path, 'rb')
try:
self.assertEquals(f.read(), contents)
self.assertEqual(f.read(), contents)
finally:
f.close()

Expand All @@ -249,10 +249,10 @@ def test_empty(self):

# Verify index entries
index = repo.open_index()
self.assertEquals(len(index), 0)
self.assertEqual(len(index), 0)

# Verify no files
self.assertEquals(['.git'], os.listdir(repo.path))
self.assertEqual(['.git'], os.listdir(repo.path))

def test_nonempty(self):
if os.name != 'posix':
Expand Down Expand Up @@ -282,7 +282,7 @@ def test_nonempty(self):

# Verify index entries
index = repo.open_index()
self.assertEquals(len(index), 4)
self.assertEqual(len(index), 4)

# filea
apath = os.path.join(repo.path, 'a')
Expand Down Expand Up @@ -313,9 +313,9 @@ def test_nonempty(self):
self.assertFileContents(epath, 'd', symlink=True)

# Verify no extra files
self.assertEquals(['.git', 'a', 'b', 'c'],
self.assertEqual(['.git', 'a', 'b', 'c'],
sorted(os.listdir(repo.path)))
self.assertEquals(['d', 'e'],
self.assertEqual(['d', 'e'],
sorted(os.listdir(os.path.join(repo.path, 'c'))))


Expand Down
4 changes: 2 additions & 2 deletions dulwich/tests/test_missing_obj_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def assertMissingMatch(self, haves, wants, expected):
"(%s,%s) erroneously reported as missing" % (sha, path))
expected.remove(sha)

self.assertEquals(len(expected), 0,
self.assertEqual(len(expected), 0,
"some objects are not reported as missing: %s" % (expected, ))


Expand Down Expand Up @@ -143,7 +143,7 @@ def setUp(self):
self.f2_3_id = f2_3.id
self.f3_3_id = f3_3.id

self.assertEquals(f1_2.id, f1_7.id, "[sanity]")
self.assertEqual(f1_2.id, f1_7.id, "[sanity]")

def test_have6_want7(self):
# have 6, want 7. Ideally, shall not report f1_7 as it's the same as
Expand Down
4 changes: 2 additions & 2 deletions dulwich/tests/test_object_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def test_pack_loose_objects(self):
self.store.add_object(b2)
self.assertEqual([], self.store.packs)
self.assertEqual(2, self.store.pack_loose_objects())
self.assertNotEquals([], self.store.packs)
self.assertNotEqual([], self.store.packs)
self.assertEqual(0, self.store.pack_loose_objects())


Expand Down Expand Up @@ -442,6 +442,6 @@ def test_only_once(self):
walk.append(next(gw))
self.assertIs(None, next(gw))

self.assertEquals(["a", "b", "c", "d"], sorted(walk))
self.assertEqual(["a", "b", "c", "d"], sorted(walk))
self.assertLess(walk.index("a"), walk.index("c"))
self.assertLess(walk.index("b"), walk.index("d"))
2 changes: 1 addition & 1 deletion dulwich/tests/test_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ def test_deserialize_mergetags(self):

d = Commit()
d._deserialize(commit.as_raw_chunks())
self.assertEquals(commit, d)
self.assertEqual(commit, d)


default_committer = 'James Westby <jw+debian@jameswestby.net> 1174773719 +0000'
Expand Down
4 changes: 2 additions & 2 deletions dulwich/tests/test_objectspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def test_blob_by_sha(self):
r = MemoryRepo()
b = Blob.from_string("Blah")
r.object_store.add_object(b)
self.assertEquals(b, parse_object(r, b.id))
self.assertEqual(b, parse_object(r, b.id))


class ParseCommitRangeTests(TestCase):
Expand All @@ -67,4 +67,4 @@ def test_commit_by_sha(self):
r = MemoryRepo()
c1, c2, c3 = build_commit_graph(r.object_store, [[1], [2, 1],
[3, 1, 2]])
self.assertEquals([c1], list(parse_commit_range(r, c1.id)))
self.assertEqual([c1], list(parse_commit_range(r, c1.id)))
4 changes: 2 additions & 2 deletions dulwich/tests/test_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ def test_decompress_empty(self):
read = BytesIO(comp + self.extra).read
unused = read_zlib_chunks(read, unpacked)
self.assertEqual('', ''.join(unpacked.decomp_chunks))
self.assertNotEquals('', unused)
self.assertNotEqual('', unused)
self.assertEqual(self.extra, unused + read())

def test_decompress_no_crc32(self):
Expand All @@ -696,7 +696,7 @@ def _do_decompress_test(self, buffer_size, **kwargs):
buffer_size=buffer_size, **kwargs)
self.assertEqual(self.decomp, ''.join(self.unpacked.decomp_chunks))
self.assertEqual(zlib.crc32(self.comp), self.unpacked.crc32)
self.assertNotEquals('', unused)
self.assertNotEqual('', unused)
self.assertEqual(self.extra, unused + self.read())

def test_simple_decompress(self):
Expand Down
54 changes: 27 additions & 27 deletions dulwich/tests/test_porcelain.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ def test_simple(self):
err = BytesIO()
porcelain.archive(self.repo.path, "refs/heads/master", outstream=out,
errstream=err)
self.assertEquals("", err.getvalue())
self.assertEqual("", err.getvalue())
tf = tarfile.TarFile(fileobj=out)
self.addCleanup(tf.close)
self.assertEquals([], tf.getnames())
self.assertEqual([], tf.getnames())


class UpdateServerInfoTests(PorcelainTestCase):
Expand All @@ -86,7 +86,7 @@ def test_custom_author(self):
sha = porcelain.commit(self.repo.path, message="Some message",
author="Joe <joe@example.com>", committer="Bob <bob@example.com>")
self.assertTrue(isinstance(sha, str))
self.assertEquals(len(sha), 40)
self.assertEqual(len(sha), 40)


class CloneTests(PorcelainTestCase):
Expand All @@ -106,8 +106,8 @@ def test_simple_local(self):
self.addCleanup(shutil.rmtree, target_path)
r = porcelain.clone(self.repo.path, target_path,
checkout=False, outstream=outstream)
self.assertEquals(r.path, target_path)
self.assertEquals(Repo(target_path).head(), c3.id)
self.assertEqual(r.path, target_path)
self.assertEqual(Repo(target_path).head(), c3.id)
self.assertTrue('f1' not in os.listdir(target_path))
self.assertTrue('f2' not in os.listdir(target_path))

Expand All @@ -126,8 +126,8 @@ def test_simple_local_with_checkout(self):
self.addCleanup(shutil.rmtree, target_path)
r = porcelain.clone(self.repo.path, target_path,
checkout=True, outstream=outstream)
self.assertEquals(r.path, target_path)
self.assertEquals(Repo(target_path).head(), c3.id)
self.assertEqual(r.path, target_path)
self.assertEqual(Repo(target_path).head(), c3.id)
self.assertTrue('f1' in os.listdir(target_path))
self.assertTrue('f2' in os.listdir(target_path))

Expand All @@ -146,8 +146,8 @@ def test_bare_local_with_checkout(self):
self.addCleanup(shutil.rmtree, target_path)
r = porcelain.clone(self.repo.path, target_path,
bare=True, outstream=outstream)
self.assertEquals(r.path, target_path)
self.assertEquals(Repo(target_path).head(), c3.id)
self.assertEqual(r.path, target_path)
self.assertEqual(Repo(target_path).head(), c3.id)
self.assertFalse('f1' in os.listdir(target_path))
self.assertFalse('f2' in os.listdir(target_path))

Expand Down Expand Up @@ -199,7 +199,7 @@ def test_add_default_paths(self):

# Check that foo was added and nothing in .git was modified
index = self.repo.open_index()
self.assertEquals(list(index), ['blah', 'foo', 'adir/afile'])
self.assertEqual(list(index), ['blah', 'foo', 'adir/afile'])

def test_add_file(self):
with open(os.path.join(self.repo.path, 'foo'), 'w') as f:
Expand Down Expand Up @@ -227,15 +227,15 @@ def test_simple(self):
self.repo.refs["HEAD"] = c3.id
outstream = BytesIO()
porcelain.log(self.repo.path, outstream=outstream)
self.assertEquals(3, outstream.getvalue().count("-" * 50))
self.assertEqual(3, outstream.getvalue().count("-" * 50))

def test_max_entries(self):
c1, c2, c3 = build_commit_graph(self.repo.object_store, [[1], [2, 1],
[3, 1, 2]])
self.repo.refs["HEAD"] = c3.id
outstream = BytesIO()
porcelain.log(self.repo.path, outstream=outstream, max_entries=1)
self.assertEquals(1, outstream.getvalue().count("-" * 50))
self.assertEqual(1, outstream.getvalue().count("-" * 50))


class ShowTests(PorcelainTestCase):
Expand All @@ -261,7 +261,7 @@ def test_blob(self):
self.repo.object_store.add_object(b)
outstream = BytesIO()
porcelain.show(self.repo.path, objects=[b.id], outstream=outstream)
self.assertEquals(outstream.getvalue(), "The Foo\n")
self.assertEqual(outstream.getvalue(), "The Foo\n")


class SymbolicRefTests(PorcelainTestCase):
Expand Down Expand Up @@ -313,7 +313,7 @@ def test_empty(self):
self.repo.refs["HEAD"] = c3.id
outstream = BytesIO()
porcelain.diff_tree(self.repo.path, c2.tree, c3.tree, outstream=outstream)
self.assertEquals(outstream.getvalue(), "")
self.assertEqual(outstream.getvalue(), "")


class CommitTreeTests(PorcelainTestCase):
Expand All @@ -332,7 +332,7 @@ def test_simple(self):
author="Joe <joe@example.com>",
committer="Jane <jane@example.com>")
self.assertTrue(isinstance(sha, str))
self.assertEquals(len(sha), 40)
self.assertEqual(len(sha), 40)


class RevListTests(PorcelainTestCase):
Expand All @@ -343,7 +343,7 @@ def test_simple(self):
outstream = BytesIO()
porcelain.rev_list(
self.repo.path, [c3.id], outstream=outstream)
self.assertEquals(
self.assertEqual(
"%s\n%s\n%s\n" % (c3.id, c2.id, c1.id),
outstream.getvalue())

Expand All @@ -359,11 +359,11 @@ def test_annotated(self):
annotated=True)

tags = self.repo.refs.as_dict("refs/tags")
self.assertEquals(tags.keys(), ["tryme"])
self.assertEqual(tags.keys(), ["tryme"])
tag = self.repo['refs/tags/tryme']
self.assertTrue(isinstance(tag, Tag))
self.assertEquals("foo <foo@bar.com>", tag.tagger)
self.assertEquals("bar", tag.message)
self.assertEqual("foo <foo@bar.com>", tag.tagger)
self.assertEqual("bar", tag.message)

def test_unannotated(self):
c1, c2, c3 = build_commit_graph(self.repo.object_store, [[1], [2, 1],
Expand All @@ -373,23 +373,23 @@ def test_unannotated(self):
porcelain.tag(self.repo.path, "tryme", annotated=False)

tags = self.repo.refs.as_dict("refs/tags")
self.assertEquals(tags.keys(), ["tryme"])
self.assertEqual(tags.keys(), ["tryme"])
tag = self.repo['refs/tags/tryme']
self.assertEquals(tags.values(), [self.repo.head()])
self.assertEqual(tags.values(), [self.repo.head()])


class ListTagsTests(PorcelainTestCase):

def test_empty(self):
tags = porcelain.list_tags(self.repo.path)
self.assertEquals([], tags)
self.assertEqual([], tags)

def test_simple(self):
self.repo.refs["refs/tags/foo"] = "aa" * 20
self.repo.refs["refs/tags/bar/bla"] = "bb" * 20
tags = porcelain.list_tags(self.repo.path)

self.assertEquals(["bar/bla", "foo"], tags)
self.assertEqual(["bar/bla", "foo"], tags)


class ResetTests(PorcelainTestCase):
Expand Down Expand Up @@ -418,7 +418,7 @@ def test_hard_head(self):
index.commit(self.repo.object_store),
self.repo['HEAD'].tree))

self.assertEquals([], changes)
self.assertEqual([], changes)


class PushTests(PorcelainTestCase):
Expand Down Expand Up @@ -461,8 +461,8 @@ def test_simple(self):
change = list(tree_changes(self.repo, self.repo['HEAD'].tree,
self.repo['refs/heads/foo'].tree))[0]

self.assertEquals(r_clone['HEAD'].id, self.repo[refs_path].id)
self.assertEquals(os.path.basename(fullpath), change.new.path)
self.assertEqual(r_clone['HEAD'].id, self.repo[refs_path].id)
self.assertEqual(os.path.basename(fullpath), change.new.path)


class PullTests(PorcelainTestCase):
Expand Down Expand Up @@ -495,7 +495,7 @@ def test_simple(self):

# Check the target repo for pushed changes
r = Repo(target_path)
self.assertEquals(r['HEAD'].id, self.repo['HEAD'].id)
self.assertEqual(r['HEAD'].id, self.repo['HEAD'].id)


class StatusTests(PorcelainTestCase):
Expand Down
4 changes: 2 additions & 2 deletions dulwich/tests/test_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,13 @@ def test_get_description(self):
f.write("Some description")
finally:
f.close()
self.assertEquals("Some description", r.get_description())
self.assertEqual("Some description", r.get_description())

def test_set_description(self):
r = self._repo = open_repo('a.git')
description = "Some description"
r.set_description(description)
self.assertEquals(description, r.get_description())
self.assertEqual(description, r.get_description())

def test_contains_missing(self):
r = self._repo = open_repo('a.git')
Expand Down
Loading

0 comments on commit f642d34

Please sign in to comment.