summaryrefslogtreecommitdiff
path: root/git/test
diff options
context:
space:
mode:
authorHarmon <Harmon758@gmail.com>2020-02-25 11:04:34 -0600
committerHarmon <Harmon758@gmail.com>2020-02-25 11:04:34 -0600
commitd39bd5345af82e3acbdc1ecb348951b05a5ed1f6 (patch)
treedfccb83bafd000d0704d473e1090a4158da136f9 /git/test
parentac286162b577c35ce855a3048c82808b30b217a8 (diff)
downloadgitpython-d39bd5345af82e3acbdc1ecb348951b05a5ed1f6.tar.gz
Remove now unnecessary explicit Unicode string literal prefixes
Diffstat (limited to 'git/test')
-rw-r--r--git/test/test_base.py2
-rw-r--r--git/test/test_commit.py10
-rw-r--r--git/test/test_diff.py48
-rw-r--r--git/test/test_git.py4
-rw-r--r--git/test/test_index.py24
-rw-r--r--git/test/test_repo.py8
6 files changed, 48 insertions, 48 deletions
diff --git a/git/test/test_base.py b/git/test/test_base.py
index ee2e8e07..9cbbcf23 100644
--- a/git/test/test_base.py
+++ b/git/test/test_base.py
@@ -122,7 +122,7 @@ class TestBase(TestBase):
"Unicode woes, see https://github.com/gitpython-developers/GitPython/pull/519")
@with_rw_repo('0.1.6')
def test_add_unicode(self, rw_repo):
- filename = u"שלום.txt"
+ filename = "שלום.txt"
file_path = osp.join(rw_repo.working_dir, filename)
diff --git a/git/test/test_commit.py b/git/test/test_commit.py
index 0e94bcb6..2b901e8b 100644
--- a/git/test/test_commit.py
+++ b/git/test/test_commit.py
@@ -132,9 +132,9 @@ class TestCommit(TestCommitSerialization):
def test_unicode_actor(self):
# assure we can parse unicode actors correctly
- name = u"Üäöß ÄußÉ"
+ name = "Üäöß ÄußÉ"
self.assertEqual(len(name), 9)
- special = Actor._from_string(u"%s <something@this.com>" % name)
+ special = Actor._from_string("%s <something@this.com>" % name)
self.assertEqual(special.name, name)
assert isinstance(special.name, str)
@@ -283,10 +283,10 @@ class TestCommit(TestCommitSerialization):
assert isinstance(cmt.message, str) # it automatically decodes it as such
assert isinstance(cmt.author.name, str) # same here
- cmt.message = u"üäêèß"
+ cmt.message = "üäêèß"
self.assertEqual(len(cmt.message), 5)
- cmt.author.name = u"äüß"
+ cmt.author.name = "äüß"
self.assertEqual(len(cmt.author.name), 3)
cstream = BytesIO()
@@ -308,7 +308,7 @@ class TestCommit(TestCommitSerialization):
with open(fixture_path('commit_invalid_data'), 'rb') as fd:
cmt._deserialize(fd)
- self.assertEqual(cmt.author.name, u'E.Azer Ko�o�o�oculu', cmt.author.name)
+ self.assertEqual(cmt.author.name, 'E.Azer Ko�o�o�oculu', cmt.author.name)
self.assertEqual(cmt.author.email, 'azer@kodfabrik.com', cmt.author.email)
def test_gpgsig(self):
diff --git a/git/test/test_diff.py b/git/test/test_diff.py
index 41907a91..0b4c1aa6 100644
--- a/git/test/test_diff.py
+++ b/git/test/test_diff.py
@@ -106,8 +106,8 @@ class TestDiff(TestBase):
diff = diffs[0]
self.assertTrue(diff.renamed_file)
self.assertTrue(diff.renamed)
- self.assertEqual(diff.rename_from, u'Jérôme')
- self.assertEqual(diff.rename_to, u'müller')
+ self.assertEqual(diff.rename_from, 'Jérôme')
+ self.assertEqual(diff.rename_to, '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)
@@ -133,8 +133,8 @@ class TestDiff(TestBase):
diff = diffs[0]
self.assertTrue(diff.copied_file)
- self.assertTrue(diff.a_path, u'test1.txt')
- self.assertTrue(diff.b_path, u'test2.txt')
+ self.assertTrue(diff.a_path, 'test1.txt')
+ self.assertTrue(diff.b_path, 'test2.txt')
assert isinstance(str(diff), str)
output = StringProcessAdapter(fixture('diff_copied_mode_raw'))
@@ -143,8 +143,8 @@ class TestDiff(TestBase):
diff = diffs[0]
self.assertEqual(diff.change_type, 'C')
self.assertEqual(diff.score, 100)
- self.assertEqual(diff.a_path, u'test1.txt')
- self.assertEqual(diff.b_path, u'test2.txt')
+ self.assertEqual(diff.a_path, 'test1.txt')
+ self.assertEqual(diff.b_path, 'test2.txt')
self.assertEqual(len(list(diffs.iter_change_type('C'))), 1)
def test_diff_with_change_in_type(self):
@@ -237,29 +237,29 @@ class TestDiff(TestBase):
res = Diff._index_from_patch_format(None, output)
# The "Additions"
- self.assertEqual(res[0].b_path, u'path/ starting with a space')
- self.assertEqual(res[1].b_path, u'path/"with-quotes"')
- self.assertEqual(res[2].b_path, u"path/'with-single-quotes'")
- self.assertEqual(res[3].b_path, u'path/ending in a space ')
- self.assertEqual(res[4].b_path, u'path/with\ttab')
- self.assertEqual(res[5].b_path, u'path/with\nnewline')
- self.assertEqual(res[6].b_path, u'path/with spaces')
- self.assertEqual(res[7].b_path, u'path/with-question-mark?')
- self.assertEqual(res[8].b_path, u'path/¯\\_(ツ)_|¯')
- self.assertEqual(res[9].b_path, u'path/💩.txt')
+ self.assertEqual(res[0].b_path, 'path/ starting with a space')
+ self.assertEqual(res[1].b_path, 'path/"with-quotes"')
+ self.assertEqual(res[2].b_path, "path/'with-single-quotes'")
+ self.assertEqual(res[3].b_path, 'path/ending in a space ')
+ self.assertEqual(res[4].b_path, 'path/with\ttab')
+ self.assertEqual(res[5].b_path, 'path/with\nnewline')
+ self.assertEqual(res[6].b_path, 'path/with spaces')
+ self.assertEqual(res[7].b_path, 'path/with-question-mark?')
+ self.assertEqual(res[8].b_path, 'path/¯\\_(ツ)_|¯')
+ self.assertEqual(res[9].b_path, 'path/💩.txt')
self.assertEqual(res[9].b_rawpath, b'path/\xf0\x9f\x92\xa9.txt')
- self.assertEqual(res[10].b_path, u'path/�-invalid-unicode-path.txt')
+ self.assertEqual(res[10].b_path, 'path/�-invalid-unicode-path.txt')
self.assertEqual(res[10].b_rawpath, b'path/\x80-invalid-unicode-path.txt')
# The "Moves"
# NOTE: The path prefixes a/ and b/ here are legit! We're actually
# verifying that it's not "a/a/" that shows up, see the fixture data.
- self.assertEqual(res[11].a_path, u'a/with spaces') # NOTE: path a/ here legit!
- self.assertEqual(res[11].b_path, u'b/with some spaces') # NOTE: path b/ here legit!
- self.assertEqual(res[12].a_path, u'a/ending in a space ')
- self.assertEqual(res[12].b_path, u'b/ending with space ')
- self.assertEqual(res[13].a_path, u'a/"with-quotes"')
- self.assertEqual(res[13].b_path, u'b/"with even more quotes"')
+ self.assertEqual(res[11].a_path, 'a/with spaces') # NOTE: path a/ here legit!
+ self.assertEqual(res[11].b_path, 'b/with some spaces') # NOTE: path b/ here legit!
+ self.assertEqual(res[12].a_path, 'a/ending in a space ')
+ self.assertEqual(res[12].b_path, 'b/ending with space ')
+ self.assertEqual(res[13].a_path, 'a/"with-quotes"')
+ self.assertEqual(res[13].b_path, 'b/"with even more quotes"')
def test_diff_patch_format(self):
# test all of the 'old' format diffs for completness - it should at least
@@ -277,7 +277,7 @@ class TestDiff(TestBase):
data = StringProcessAdapter(fixture('diff_file_with_spaces'))
diff_index = Diff._index_from_patch_format(self.rorepo, data)
self.assertIsNone(diff_index[0].a_path, repr(diff_index[0].a_path))
- self.assertEqual(diff_index[0].b_path, u'file with spaces', repr(diff_index[0].b_path))
+ self.assertEqual(diff_index[0].b_path, 'file with spaces', repr(diff_index[0].b_path))
def test_diff_submodule(self):
"""Test that diff is able to correctly diff commits that cover submodule changes"""
diff --git a/git/test/test_git.py b/git/test/test_git.py
index 060a4c3c..1e3cac8f 100644
--- a/git/test/test_git.py
+++ b/git/test/test_git.py
@@ -50,12 +50,12 @@ class TestGit(TestBase):
self.assertEqual(git.call_args, ((['git', 'version'],), {}))
def test_call_unpack_args_unicode(self):
- args = Git._Git__unpack_args(u'Unicode€™')
+ args = Git._Git__unpack_args('Unicode€™')
mangled_value = 'Unicode\u20ac\u2122'
self.assertEqual(args, [mangled_value])
def test_call_unpack_args(self):
- args = Git._Git__unpack_args(['git', 'log', '--', u'Unicode€™'])
+ args = Git._Git__unpack_args(['git', 'log', '--', 'Unicode€™'])
mangled_value = 'Unicode\u20ac\u2122'
self.assertEqual(args, ['git', 'log', '--', mangled_value])
diff --git a/git/test/test_index.py b/git/test/test_index.py
index 355cd87e..3575348a 100644
--- a/git/test/test_index.py
+++ b/git/test/test_index.py
@@ -429,7 +429,7 @@ class TestIndex(TestBase):
num_entries = len(index.entries)
cur_head = rw_repo.head
- uname = u"Thomas Müller"
+ uname = "Thomas Müller"
umail = "sd@company.com"
with rw_repo.config_writer() as writer:
writer.set_value("user", "name", uname)
@@ -484,7 +484,7 @@ class TestIndex(TestBase):
# TEST COMMITTING
# commit changed index
cur_commit = cur_head.commit
- commit_message = u"commit default head by Frèderic Çaufl€"
+ commit_message = "commit default head by Frèderic Çaufl€"
new_commit = index.commit(commit_message, head=False)
assert cur_commit != new_commit
@@ -500,13 +500,13 @@ class TestIndex(TestBase):
# commit with other actor
cur_commit = cur_head.commit
- my_author = Actor(u"Frèderic Çaufl€", "author@example.com")
- my_committer = Actor(u"Committing Frèderic Çaufl€", "committer@example.com")
+ my_author = Actor("Frèderic Çaufl€", "author@example.com")
+ my_committer = Actor("Committing Frèderic Çaufl€", "committer@example.com")
commit_actor = index.commit(commit_message, author=my_author, committer=my_committer)
assert cur_commit != commit_actor
- self.assertEqual(commit_actor.author.name, u"Frèderic Çaufl€")
+ self.assertEqual(commit_actor.author.name, "Frèderic Çaufl€")
self.assertEqual(commit_actor.author.email, "author@example.com")
- self.assertEqual(commit_actor.committer.name, u"Committing Frèderic Çaufl€")
+ self.assertEqual(commit_actor.committer.name, "Committing Frèderic Çaufl€")
self.assertEqual(commit_actor.committer.email, "committer@example.com")
self.assertEqual(commit_actor.message, commit_message)
self.assertEqual(commit_actor.parents[0], cur_commit)
@@ -516,7 +516,7 @@ class TestIndex(TestBase):
# commit with author_date and commit_date
cur_commit = cur_head.commit
- commit_message = u"commit with dates by Avinash Sajjanshetty"
+ commit_message = "commit with dates by Avinash Sajjanshetty"
new_commit = index.commit(commit_message, author_date="2006-04-07T22:13:13", commit_date="2005-04-07T22:13:13")
assert cur_commit != new_commit
@@ -777,7 +777,7 @@ class TestIndex(TestBase):
def test_index_single_addremove(self, rw_repo):
fp = osp.join(rw_repo.working_dir, 'testfile.txt')
with open(fp, 'w') as fs:
- fs.write(u'content of testfile')
+ fs.write('content of testfile')
self._assert_entries(rw_repo.index.add(fp))
deleted_files = rw_repo.index.remove(fp)
assert deleted_files
@@ -826,7 +826,7 @@ class TestIndex(TestBase):
# NOTE: fp is not a Unicode object in python 2 (which is the source of the problem)
fp = osp.join(rw_dir, 'ø.txt')
with open(fp, 'wb') as fs:
- fs.write(u'content of ø'.encode('utf-8'))
+ fs.write('content of ø'.encode('utf-8'))
r = Repo.init(rw_dir)
r.index.add([fp])
@@ -896,8 +896,8 @@ class TestIndex(TestBase):
@with_rw_repo('HEAD', bare=True)
def test_commit_msg_hook_success(self, rw_repo):
- commit_message = u"commit default head by Frèderic Çaufl€"
- from_hook_message = u"from commit-msg"
+ commit_message = "commit default head by Frèderic Çaufl€"
+ from_hook_message = "from commit-msg"
index = rw_repo.index
_make_hook(
index.repo.git_dir,
@@ -905,7 +905,7 @@ class TestIndex(TestBase):
'printf " {}" >> "$1"'.format(from_hook_message)
)
new_commit = index.commit(commit_message)
- self.assertEqual(new_commit.message, u"{} {}".format(commit_message, from_hook_message))
+ self.assertEqual(new_commit.message, "{} {}".format(commit_message, from_hook_message))
@with_rw_repo('HEAD', bare=True)
def test_commit_msg_hook_fail(self, rw_repo):
diff --git a/git/test/test_repo.py b/git/test/test_repo.py
index 6fcbc17a..590e303e 100644
--- a/git/test/test_repo.py
+++ b/git/test/test_repo.py
@@ -453,7 +453,7 @@ class TestRepo(TestBase):
self.assertEqual(commits, ['82b8902', '82b8902', 'c76852d', 'c76852d', 'c76852d'])
# Original filenames
- self.assertSequenceEqual([entry.orig_path for entry in blame_output], [u'AUTHORS'] * len(blame_output))
+ self.assertSequenceEqual([entry.orig_path for entry in blame_output], ['AUTHORS'] * len(blame_output))
# Original line numbers
orig_ranges = flatten([entry.orig_linenos for entry in blame_output])
@@ -478,10 +478,10 @@ class TestRepo(TestBase):
def test_untracked_files(self, rwrepo):
for run, repo_add in enumerate((rwrepo.index.add, rwrepo.git.add)):
base = rwrepo.working_tree_dir
- files = (join_path_native(base, u"%i_test _myfile" % run),
+ files = (join_path_native(base, "%i_test _myfile" % run),
join_path_native(base, "%i_test_other_file" % run),
- join_path_native(base, u"%i__çava verböten" % run),
- join_path_native(base, u"%i_çava-----verböten" % run))
+ join_path_native(base, "%i__çava verböten" % run),
+ join_path_native(base, "%i_çava-----verböten" % run))
num_recently_untracked = 0
for fpath in files: