Commit 665f559a authored by Jim Fulton's avatar Jim Fulton

implement excellent reviewer suggestions

parent 32bd5a7a
......@@ -175,15 +175,16 @@ class TransactionManager(object):
doc = func.__doc__
if name != '_':
if doc:
doc = name + u'\n\n' + doc
doc = name + '\n\n' + doc
else:
doc = name
if doc and not isinstance(doc, text_type):
doc = doc.decode('utf-8')
for i in range(1, tries + 1):
txn = self.begin()
if doc:
if not isinstance(doc, text_type):
doc = doc.decode('ascii')
txn.note(doc)
try:
......
......@@ -548,7 +548,7 @@ class Transaction(object):
if not isinstance(user_name, text_type):
raise TypeError("User name must be text (unicode)")
if not isinstance(path, text_type):
raise TypeError("User name must be text (unicode)")
raise TypeError("Path must be text (unicode)")
self.user = u"%s %s" % (path, user_name)
def setExtendedInfo(self, name, value):
......
......@@ -992,7 +992,7 @@ class TransactionTests(unittest.TestCase):
def test_description_bytes(self):
txn = self._makeOne()
with self.assertRaises((UnicodeDecodeError, TypeError)):
with self.assertRaises(TypeError):
txn.description = b'haha'
def test_setUser_default_path(self):
......@@ -1007,13 +1007,13 @@ class TransactionTests(unittest.TestCase):
def test_user_bytes(self):
txn = self._makeOne()
with self.assertRaises((UnicodeDecodeError, TypeError)):
with self.assertRaises(TypeError):
txn.user = b'phreddy'
with self.assertRaises((UnicodeDecodeError, TypeError)):
with self.assertRaises(TypeError):
txn.setUser(b'phreddy', u'/bedrock')
with self.assertRaises((UnicodeDecodeError, TypeError)):
with self.assertRaises(TypeError):
txn.setUser(u'phreddy', b'/bedrock')
with self.assertRaises((UnicodeDecodeError, TypeError)):
with self.assertRaises(TypeError):
txn.setUser(b'phreddy')
def test_setExtendedInfo_single(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment