Skip to content

Commit 0f88fb9

Browse files
committed
Added test to verify the actor type can handle and parse unicode if it is passed in
test_odb: added more information to the message output
1 parent 741dfaa commit 0f88fb9

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

lib/git/ext/gitdb

Submodule gitdb updated from 425ecf0 to 78665b1

test/git/performance/test_odb.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,18 @@ def test_random_access(self):
4949
st = time()
5050
nb = 0
5151
too_many = 15000
52+
data_bytes = 0
5253
for blob_list in blobs_per_commit:
5354
for blob in blob_list:
54-
blob.data_stream.read()
55+
data_bytes += len(blob.data_stream.read())
5556
# END for each blobsha
5657
nb += len(blob_list)
5758
if nb > too_many:
5859
break
5960
# END for each bloblist
6061
elapsed = time() - st
6162

62-
print >> sys.stderr, "%s: Retrieved %i blob and their data in %g s ( %f blobs / s )" % (type(repo.odb), nb, elapsed, nb / elapsed)
63+
print >> sys.stderr, "%s: Retrieved %i blob (%i KiB) and their data in %g s ( %f blobs / s, %f KiB / s )" % (type(repo.odb), nb, data_bytes/1000, elapsed, nb / elapsed, (data_bytes / 1000) / elapsed)
6364
results[2].append(elapsed)
6465
# END for each repo type
6566

test/git/test_commit.py

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
# test_commit.py
23
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
34
#
@@ -108,6 +109,14 @@ def check_entries(d):
108109
assert commit.committer_tz_offset == 14400, commit.committer_tz_offset
109110
assert commit.message == "initial project\n"
110111

112+
def test_unicode_actor(self):
113+
# assure we can parse unicode actors correctly
114+
name = "Üäöß ÄußÉ".decode("utf-8")
115+
assert len(name) == 9
116+
special = Actor._from_string(u"%s <something@this.com>" % name)
117+
assert special.name == name
118+
assert isinstance(special.name, unicode)
119+
111120
def test_traversal(self):
112121
start = self.rorepo.commit("a4d06724202afccd2b5c54f81bcf2bf26dea7fff")
113122
first = self.rorepo.commit("33ebe7acec14b25c5f84f35a664803fcab2f7781")

0 commit comments

Comments
 (0)