Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DuniterPy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
python
DuniterPy
Commits
687d3661
Commit
687d3661
authored
6 years ago
by
Vincent Texier
Browse files
Options
Downloads
Patches
Plain Diff
[fix]
#94
fix pylint alerts on tests.documents package
parent
ecaaea89
Branches
Branches containing commit
No related tags found
1 merge request
!66
Merge of check_tests_and_examples to dev
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
tests/documents/test_peer.py
+1
-0
1 addition, 0 deletions
tests/documents/test_peer.py
tests/documents/test_transaction.py
+27
-6
27 additions, 6 deletions
tests/documents/test_transaction.py
tests/documents/test_ws2p_heads.py
+1
-3
1 addition, 3 deletions
tests/documents/test_ws2p_heads.py
with
29 additions
and
9 deletions
tests/documents/test_peer.py
+
1
−
0
View file @
687d3661
...
...
@@ -92,4 +92,5 @@ class TestPeer(unittest.TestCase):
def
test_incorrect
(
self
):
peer
=
Peer
.
from_signed_raw
(
test_weird_ipv6_peer
)
rendered_peer
=
peer
.
signed_raw
()
self
.
assertEqual
(
test_weird_ipv6_peer
,
rendered_peer
)
Peer
.
from_signed_raw
(
rendered_peer
)
This diff is collapsed.
Click to expand it.
tests/documents/test_transaction.py
+
27
−
6
View file @
687d3661
'''
"""
Created on 12 déc. 2014
@author: inso
'''
"""
import
unittest
import
pypeg2
from
duniterpy.grammars
import
output
from
duniterpy.documents
import
BlockUID
from
duniterpy.documents.transaction
import
Transaction
,
reduce_base
,
SimpleTransaction
,
InputSource
,
OutputSource
,
Unlock
,
SIGParameter
from
duniterpy.documents.transaction
import
Transaction
,
reduce_base
,
SimpleTransaction
,
InputSource
,
OutputSource
,
\
Unlock
,
SIGParameter
compact_change
=
"""
TX:10:1:1:1:1:1:0
13410-000041DF0CCA173F09B5FBA48F619D4BC934F12ADF1D0B798639EB2149C4A8CC
...
...
@@ -19,6 +20,23 @@ META tic to toc
eNAZpJjhZaPKbx5pUvuDDM1j4XNWJ4ABK48ouTvimvg3ceIcoZUvgLHmXuSwk2bgxZaB5qSKP9H6T7qsBcLtBg==
"""
tx_from_compact_change
=
"""
Version: 10
Type: Transaction
Currency: gtest
Blockstamp: 13410-000041DF0CCA173F09B5FBA48F619D4BC934F12ADF1D0B798639EB2149C4A8CC
Locktime: 0
Issuers:
D8BsQZN9hangHVuqwD6McfxM1xvGJ8DPuPYrswwnSif3
Inputs:
1500:1:T:0D0264F324BC4A23C4B2C696CD1907BD6E70FD1F409BB1D42E84847AA4C1E87C:0
Unlocks:
0:SIG(0)
Outputs:
1500:1:(XHX(8AFC8DF633FC158F9DB4864ABED696C1AA0FE5D617A7B5F7AB8DE7CA2EFCD4CB) && SIG(36j6pCNzKDPo92m7UXJLFpgDbcLFAZBgThD2TCwTwGrd)) || (SIG(D8BsQZN9hangHVuqwD6McfxM1xvGJ8DPuPYrswwnSif3) && SIG(36j6pCNzKDPo92m7UXJLFpgDbcLFAZBgThD2TCwTwGrd))
Comment: META tic to toc
eNAZpJjhZaPKbx5pUvuDDM1j4XNWJ4ABK48ouTvimvg3ceIcoZUvgLHmXuSwk2bgxZaB5qSKP9H6T7qsBcLtBg==
"""
xhx_output
=
"""
Version: 10
Type: Transaction
Currency: gtest
...
...
@@ -109,6 +127,7 @@ input_source_str = "30:0:T:6991C993631BED4733972ED7538E41CCC33660F554E3C51963E2A
output_source_str
=
"
460:0:SIG(8kXygUHh1vLjmcRzXVM86t38EL8dfFJgfBeHmkaWLamu)
"
class
TestTransaction
(
unittest
.
TestCase
):
def
test_fromcompact
(
self
):
tx
=
Transaction
.
from_compact
(
"
zeta_brousouf
"
,
tx_compact
)
...
...
@@ -195,7 +214,8 @@ class TestTransaction(unittest.TestCase):
def
test_fromraw_toraw
(
self
):
tx
=
Transaction
.
from_signed_raw
(
tx_raw
)
rendered_tx
=
tx
.
signed_raw
()
from_rendered_tx
=
Transaction
.
from_signed_raw
(
rendered_tx
)
self
.
assertEqual
(
tx_raw
,
rendered_tx
)
Transaction
.
from_signed_raw
(
rendered_tx
)
self
.
assertEqual
(
tx
.
version
,
10
)
self
.
assertEqual
(
tx
.
currency
,
"
beta_brousouf
"
)
...
...
@@ -270,7 +290,8 @@ class TestTransaction(unittest.TestCase):
def
test_compact_change
(
self
):
tx
=
Transaction
.
from_compact
(
"
gtest
"
,
compact_change
)
rendered_tx
=
tx
.
signed_raw
()
from_rendered_tx
=
Transaction
.
from_signed_raw
(
rendered_tx
)
self
.
assertEqual
(
tx_from_compact_change
,
rendered_tx
)
Transaction
.
from_signed_raw
(
rendered_tx
)
def
test_reduce_base
(
self
):
amount
=
1200
...
...
@@ -348,6 +369,6 @@ class TestTransaction(unittest.TestCase):
comment
=
''
,
signatures
=
[]
)
self
.
assertTrue
(
transaction
.
time
==
None
)
self
.
assertTrue
(
transaction
.
time
is
None
)
self
.
assertTrue
(
transaction
.
currency
==
"
gtest
"
)
self
.
assertTrue
(
transaction
.
inputs
[
0
].
amount
==
30
)
This diff is collapsed.
Click to expand it.
tests/documents/test_ws2p_heads.py
+
1
−
3
View file @
687d3661
import
unittest
from
duniterpy.documents.ws2p.heads
import
*
from
duniterpy.documents.ws2p.heads
import
HeadV0
,
HeadV1
,
HeadV2
,
BlockUID
headv1_clear
=
""
headv1_tor
=
""
headv2
=
""
class
TestWS2PHeads
(
unittest
.
TestCase
):
def
test_headv0
(
self
):
...
...
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