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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
python
DuniterPy
Commits
08bff6cb
Commit
08bff6cb
authored
6 years ago
by
Moul
Browse files
Options
Downloads
Patches
Plain Diff
[test] Add test of generation of the transaction document
parent
3bbe56e2
No related branches found
No related tags found
1 merge request
!64
Release 0.54.3
Pipeline
#5649
passed
6 years ago
Stage: github-sync
Stage: build
Stage: test
Stage: release
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/documents/test_transaction.py
+20
-1
20 additions, 1 deletion
tests/documents/test_transaction.py
with
20 additions
and
1 deletion
tests/documents/test_transaction.py
+
20
−
1
View file @
08bff6cb
...
@@ -6,7 +6,8 @@ Created on 12 déc. 2014
...
@@ -6,7 +6,8 @@ Created on 12 déc. 2014
import
unittest
import
unittest
import
pypeg2
import
pypeg2
from
duniterpy.grammars
import
output
from
duniterpy.grammars
import
output
from
duniterpy.documents.transaction
import
Transaction
,
reduce_base
,
SimpleTransaction
,
InputSource
,
OutputSource
from
duniterpy.documents
import
BlockUID
from
duniterpy.documents.transaction
import
Transaction
,
reduce_base
,
SimpleTransaction
,
InputSource
,
OutputSource
,
Unlock
,
SIGParameter
compact_change
=
"""
TX:10:1:1:1:1:1:0
compact_change
=
"""
TX:10:1:1:1:1:1:0
13410-000041DF0CCA173F09B5FBA48F619D4BC934F12ADF1D0B798639EB2149C4A8CC
13410-000041DF0CCA173F09B5FBA48F619D4BC934F12ADF1D0B798639EB2149C4A8CC
...
@@ -332,3 +333,21 @@ class TestTransaction(unittest.TestCase):
...
@@ -332,3 +333,21 @@ class TestTransaction(unittest.TestCase):
t2
=
Transaction
.
from_signed_raw
(
tx_raw
)
t2
=
Transaction
.
from_signed_raw
(
tx_raw
)
t2
.
outputs
=
OutputSource
.
from_inline
(
output_source_str
)
t2
.
outputs
=
OutputSource
.
from_inline
(
output_source_str
)
self
.
assertFalse
(
t1
==
t2
)
self
.
assertFalse
(
t1
==
t2
)
def
test_transaction_document_generation
(
self
):
transaction
=
Transaction
(
version
=
10
,
currency
=
"
gtest
"
,
blockstamp
=
BlockUID
(
8979
,
"
000041DF0CCA173F09B5FBA48F619D4BC934F12ADF1D0B798639EB2149C4A8CC
"
),
locktime
=
0
,
issuers
=
list
(
"
8kXygUHh1vLjmcRzXVM86t38EL8dfFJgfBeHmkaWLamu
"
),
inputs
=
[
InputSource
.
from_inline
(
input_source_str
)],
unlocks
=
[
Unlock
(
index
=
0
,
parameters
=
[
SIGParameter
(
0
)])],
outputs
=
[
OutputSource
.
from_inline
(
output_source_str
)],
comment
=
''
,
signatures
=
[]
)
self
.
assertTrue
(
transaction
.
time
==
None
)
self
.
assertTrue
(
transaction
.
currency
==
"
gtest
"
)
self
.
assertTrue
(
transaction
.
inputs
[
0
].
amount
==
30
)
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