summaryrefslogtreecommitdiff
path: root/git/test/test_git.py
diff options
context:
space:
mode:
Diffstat (limited to 'git/test/test_git.py')
-rw-r--r--git/test/test_git.py25
1 files changed, 18 insertions, 7 deletions
diff --git a/git/test/test_git.py b/git/test/test_git.py
index 553f8d1b..502e6091 100644
--- a/git/test/test_git.py
+++ b/git/test/test_git.py
@@ -1,3 +1,4 @@
+#-*-coding:utf-8-*-
# test_git.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
@@ -16,6 +17,8 @@ from git.test.lib import (TestBase,
from git import (Git,
GitCommandError)
+from git.compat import PY3
+
class TestGit(TestBase):
@@ -32,12 +35,20 @@ class TestGit(TestBase):
assert_equal(git.call_args, ((['git', 'version'],), {}))
def test_call_unpack_args_unicode(self):
- args = Git._Git__unpack_args(u'Unicode' + unichr(40960))
- assert_equal(args, ['Unicode\xea\x80\x80'])
+ args = Git._Git__unpack_args(u'Unicode€™')
+ if PY3:
+ mangled_value = 'Unicode\u20ac\u2122'
+ else:
+ mangled_value = 'Unicode\xe2\x82\xac\xe2\x84\xa2'
+ assert_equal(args, [mangled_value])
def test_call_unpack_args(self):
- args = Git._Git__unpack_args(['git', 'log', '--', u'Unicode' + unichr(40960)])
- assert_equal(args, ['git', 'log', '--', 'Unicode\xea\x80\x80'])
+ args = Git._Git__unpack_args(['git', 'log', '--', u'Unicode€™'])
+ if PY3:
+ mangled_value = 'Unicode\u20ac\u2122'
+ else:
+ mangled_value = 'Unicode\xe2\x82\xac\xe2\x84\xa2'
+ assert_equal(args, ['git', 'log', '--', mangled_value])
@raises(GitCommandError)
def test_it_raises_errors(self):
@@ -75,13 +86,13 @@ class TestGit(TestBase):
import subprocess as sp
hexsha = "b2339455342180c7cc1e9bba3e9f181f7baa5167"
g = self.git.cat_file(batch_check=True, istream=sp.PIPE, as_process=True)
- g.stdin.write("b2339455342180c7cc1e9bba3e9f181f7baa5167\n")
+ g.stdin.write(b"b2339455342180c7cc1e9bba3e9f181f7baa5167\n")
g.stdin.flush()
obj_info = g.stdout.readline()
# read header + data
g = self.git.cat_file(batch=True, istream=sp.PIPE, as_process=True)
- g.stdin.write("b2339455342180c7cc1e9bba3e9f181f7baa5167\n")
+ g.stdin.write(b"b2339455342180c7cc1e9bba3e9f181f7baa5167\n")
g.stdin.flush()
obj_info_two = g.stdout.readline()
assert obj_info == obj_info_two
@@ -92,7 +103,7 @@ class TestGit(TestBase):
g.stdout.read(1)
# now we should be able to read a new object
- g.stdin.write("b2339455342180c7cc1e9bba3e9f181f7baa5167\n")
+ g.stdin.write(b"b2339455342180c7cc1e9bba3e9f181f7baa5167\n")
g.stdin.flush()
assert g.stdout.readline() == obj_info