Skip to content

Commit

Permalink
Add test for 'txn.user = None'.
Browse files Browse the repository at this point in the history
Restores 100% coverage.
  • Loading branch information
tseaver committed Mar 16, 2017
1 parent 2bb7d05 commit f8d611a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions transaction/_transaction.py
Expand Up @@ -138,6 +138,8 @@ def user(self):
def user(self, v):
if v is not None:
self._user = text_or_warn(v)
else:
self._user = u""

@property
def description(self):
Expand Down
6 changes: 6 additions & 0 deletions transaction/tests/test__transaction.py
Expand Up @@ -1060,6 +1060,12 @@ def test_setUser_explicit_path(self):
txn.setUser(u'phreddy', u'/bedrock')
self.assertEqual(txn.user, u'/bedrock phreddy')

def test_user_w_none(self):
txn = self._makeOne()
txn.user = b'phreddy'
txn.user = None # resets to empty text
self.assertEqual(txn.user, u'')

def _test_user_non_text(self, user, path, expect, both=False):
txn = self._makeOne()
with warnings.catch_warnings(record=True) as w:
Expand Down

0 comments on commit f8d611a

Please sign in to comment.