Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
silkaj
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
python
silkaj
Commits
bf6cfe37
Commit
bf6cfe37
authored
4 years ago
by
matograine
Committed by
matograine
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[test] [fix]
#368
: wrong use of context `with pytest.raises() as...`
* correct the form of tests
parent
015b2273
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_crypto_tools.py
+2
-2
2 additions, 2 deletions
tests/test_crypto_tools.py
tests/test_unit_tx.py
+18
-23
18 additions, 23 deletions
tests/test_unit_tx.py
with
20 additions
and
25 deletions
tests/test_crypto_tools.py
+
2
−
2
View file @
bf6cfe37
This diff is collapsed.
Click to expand it.
tests/test_unit_tx.py
+
18
−
23
View file @
bf6cfe37
...
@@ -192,9 +192,9 @@ def test_compute_amounts_errors(capsys):
...
@@ -192,9 +192,9 @@ def test_compute_amounts_errors(capsys):
trial
[
0
],
trial
[
0
],
trial
[
1
],
trial
[
1
],
)
)
expected_error
=
"
Error: amount {0} is too low.
"
.
format
(
trial
[
0
][
0
])
assert
capsys
.
readouterr
()
==
expected_error
assert
pytest_exit
.
type
==
SystemExit
assert
pytest_exit
.
type
==
SystemExit
expected_error
=
"
Error: amount {0} is too low.
"
.
format
(
trial
[
0
][
0
])
assert
capsys
.
readouterr
().
out
==
expected_error
def
test_compute_amounts
():
def
test_compute_amounts
():
...
@@ -1344,6 +1344,7 @@ def test_check_transaction_values_errors(
...
@@ -1344,6 +1344,7 @@ def test_check_transaction_values_errors(
result
=
tx
.
check_transaction_values
(
result
=
tx
.
check_transaction_values
(
comment
,
outputAddresses
,
outputBackChange
,
enough_source
,
issuer_pubkey
comment
,
outputAddresses
,
outputBackChange
,
enough_source
,
issuer_pubkey
)
)
assert
pytest_exit
.
type
==
SystemExit
display
=
capsys
.
readouterr
()
display
=
capsys
.
readouterr
()
if
comment
.
find
(
"
Wrong_Char_
"
)
!=
-
1
:
if
comment
.
find
(
"
Wrong_Char_
"
)
!=
-
1
:
assert
display
==
"
Error: the format of the comment is invalid
"
assert
display
==
"
Error: the format of the comment is invalid
"
...
@@ -1353,19 +1354,13 @@ def test_check_transaction_values_errors(
...
@@ -1353,19 +1354,13 @@ def test_check_transaction_values_errors(
assert
display
.
out
.
find
(
"
Error: bad format for following public key:
"
)
!=
-
1
assert
display
.
out
.
find
(
"
Error: bad format for following public key:
"
)
!=
-
1
elif
outputBackChange
:
elif
outputBackChange
:
if
outputBackChange
==
"
Wrong_Pubkey
"
:
if
outputBackChange
==
"
Wrong_Pubkey
"
:
assert
(
assert
display
.
out
.
find
(
"
Error: bad format for following public key:
"
)
!=
-
1
display
.
out
.
find
(
"
Error: bad format for following public key:
"
)
!=
-
1
)
elif
enough_source
is
True
:
elif
enough_source
is
True
:
assert
(
assert
(
display
.
out
.
find
(
display
.
out
.
find
(
"
pubkey doesn’t have enough money for this transaction.
"
)
"
pubkey doesn’t have enough money for this transaction.
"
)
!=
-
1
!=
-
1
)
)
assert
result
==
""
assert
result
==
""
assert
pytest_exit
.
type
==
SystemExit
# test generate_unlocks()
# test generate_unlocks()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment