Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
transaction
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
transaction
Commits
6e976142
Commit
6e976142
authored
May 05, 2017
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make setting 'txn.user = None' raise ValueError.
parent
f8d611a2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
transaction/_transaction.py
transaction/_transaction.py
+3
-4
transaction/tests/test__transaction.py
transaction/tests/test__transaction.py
+3
-2
No files found.
transaction/_transaction.py
View file @
6e976142
...
@@ -136,10 +136,9 @@ class Transaction(object):
...
@@ -136,10 +136,9 @@ class Transaction(object):
@
user
.
setter
@
user
.
setter
def
user
(
self
,
v
):
def
user
(
self
,
v
):
if
v
is
not
None
:
if
v
is
None
:
self
.
_user
=
text_or_warn
(
v
)
raise
ValueError
(
"user must not be None"
)
else
:
self
.
_user
=
text_or_warn
(
v
)
self
.
_user
=
u""
@
property
@
property
def
description
(
self
):
def
description
(
self
):
...
...
transaction/tests/test__transaction.py
View file @
6e976142
...
@@ -1063,8 +1063,9 @@ class TransactionTests(unittest.TestCase):
...
@@ -1063,8 +1063,9 @@ class TransactionTests(unittest.TestCase):
def
test_user_w_none
(
self
):
def
test_user_w_none
(
self
):
txn
=
self
.
_makeOne
()
txn
=
self
.
_makeOne
()
txn
.
user
=
b'phreddy'
txn
.
user
=
b'phreddy'
txn
.
user
=
None
# resets to empty text
with
self
.
assertRaises
(
ValueError
):
self
.
assertEqual
(
txn
.
user
,
u''
)
txn
.
user
=
None
# resets to empty text
self
.
assertEqual
(
txn
.
user
,
b'phreddy'
)
def
_test_user_non_text
(
self
,
user
,
path
,
expect
,
both
=
False
):
def
_test_user_non_text
(
self
,
user
,
path
,
expect
,
both
=
False
):
txn
=
self
.
_makeOne
()
txn
=
self
.
_makeOne
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment