Skip to content

Commit 0148024

Browse files
committed
Functional test linting
1 parent 242515f commit 0148024

33 files changed

+69
-72
lines changed

test/functional/feature_assetsdir.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@
88
# Test listissuances returns a list of all issuances or specific issuances based on asset hex or asset label.
99
#
1010

11-
from decimal import Decimal
1211
from test_framework.test_framework import BitcoinTestFramework
13-
from test_framework.authproxy import JSONRPCException
1412
from test_framework.util import assert_equal, assert_greater_than
15-
from test_framework.util import *
1613

1714
class AssetdirTests(BitcoinTestFramework):
1815
"""
@@ -45,13 +42,13 @@ def run_test(self):
4542
#Check that listissuances return all issuances
4643
issuances = self.nodes[0].listissuances()
4744
assert_equal(len(issuances), 2)
48-
45+
4946
#Check all asset labels have been set: 'asset1', 'asset2'
5047
#We can not be sure they will always be returned in the same order so will loop each one
5148
label = ""
5249
for issue in issuances:
5350
label += issue["assetlabel"]
54-
51+
5552
assert_greater_than(label.find("asset1"), -1)
5653
assert_greater_than(label.find("asset2"), -1)
5754

test/functional/feature_blocksign.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import random
66

77
from test_framework.test_framework import BitcoinTestFramework
8-
from test_framework.util import (assert_raises_rpc_error, assert_equal, connect_nodes_bi, BITCOIN_ASSET)
8+
from test_framework.util import (assert_raises_rpc_error, assert_equal, connect_nodes_bi)
99
from test_framework import (
1010
address,
1111
key,

test/functional/feature_confidential_transactions.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def run_test(self):
148148
tx = self.nodes[0].createrawtransaction([{"txid": unspent[0]["txid"],
149149
"vout": unspent[0]["vout"],
150150
"nValue": unspent[0]["amount"]}],
151-
{unconfidential_address: unspent[0]["amount"] - fee, "fee":fee});
151+
{unconfidential_address: unspent[0]["amount"] - fee, "fee":fee})
152152

153153
# Test that blindrawtransaction adds an OP_RETURN output to balance blinders
154154
temptx = self.nodes[0].blindrawtransaction(tx)
@@ -164,7 +164,7 @@ def run_test(self):
164164
"vout": unspent[0]["vout"],
165165
"nValue": unspent[0]["amount"]}],
166166
{unconfidential_address: value4,
167-
change_address: unspent[0]["amount"] - value4 - fee, "fee":fee});
167+
change_address: unspent[0]["amount"] - value4 - fee, "fee":fee})
168168
tx = self.nodes[0].blindrawtransaction(tx)
169169
tx_signed = self.nodes[0].signrawtransactionwithwallet(tx)
170170
txid = self.nodes[0].sendrawtransaction(tx_signed['hex'])
@@ -222,7 +222,7 @@ def run_test(self):
222222
# therefore result will be same even though we change blinding keys
223223
assert_equal(len(self.nodes[0].listunspent(0, 0, [new_validated["unconfidential"]])), 1)
224224

225-
#### Confidential Assets Tests ####
225+
# Confidential Assets Tests
226226

227227
print("Assets tests...")
228228

@@ -295,8 +295,8 @@ def run_test(self):
295295
self.nodes[2].generate(1)
296296
self.sync_all()
297297

298-
redata1 = self.nodes[1].reissueasset(issuancedata["asset"], Decimal('0.05'))
299-
redata2 = self.nodes[2].reissueasset(issuancedata["asset"], Decimal('0.025'))
298+
self.nodes[1].reissueasset(issuancedata["asset"], Decimal('0.05'))
299+
self.nodes[2].reissueasset(issuancedata["asset"], Decimal('0.025'))
300300
self.nodes[1].generate(1)
301301
self.sync_all()
302302

@@ -349,8 +349,8 @@ def run_test(self):
349349
# Basic checks of rawblindrawtransaction functionality
350350
blinded_addr = self.nodes[0].getnewaddress()
351351
addr = self.nodes[0].validateaddress(blinded_addr)["unconfidential"]
352-
txid1 = self.nodes[0].sendtoaddress(blinded_addr, 1)
353-
txid2 = self.nodes[0].sendtoaddress(blinded_addr, 3)
352+
self.nodes[0].sendtoaddress(blinded_addr, 1)
353+
self.nodes[0].sendtoaddress(blinded_addr, 3)
354354
unspent = self.nodes[0].listunspent(0, 0)
355355
assert_equal(len(unspent), 4)
356356
rawtx = self.nodes[0].createrawtransaction([{"txid":unspent[0]["txid"], "vout":unspent[0]["vout"]}, {"txid":unspent[1]["txid"], "vout":unspent[1]["vout"]}], {addr:unspent[0]["amount"]+unspent[1]["amount"]-Decimal("0.2"), "fee":Decimal("0.2")})

test/functional/feature_default_asset_name.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
# Test chain initialisation when specifying default asset name.
88
#
99

10-
from decimal import Decimal
1110
from test_framework.test_framework import BitcoinTestFramework
12-
from test_framework.authproxy import JSONRPCException
1311
from test_framework.util import assert_equal, connect_nodes_bi
1412

1513
class NamedDefaultAssetTest(BitcoinTestFramework):
@@ -42,7 +40,7 @@ def run_test(self):
4240
assert_equal(walletinfo1["balance"]["testasset"], 21000000)
4341

4442
#Send some of the default asset to the second node
45-
self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 1, "", "", False)
43+
self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 1, "", "", False)
4644
self.nodes[0].generate(101)
4745
self.sync_all()
4846

test/functional/feature_initial_reissuance_token.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@
77
# Test chain initialisation when specifying number of reissuance tokens to issue.
88
#
99

10-
from decimal import Decimal
1110
from test_framework.test_framework import BitcoinTestFramework
12-
from test_framework.authproxy import JSONRPCException
1311
from test_framework.util import connect_nodes_bi, assert_equal
14-
from test_framework.util import *
1512

1613
class InitialReissuanceTokenTest(BitcoinTestFramework):
1714
"""

test/functional/feature_issuance.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ def process_raw_issuance(node, issuance_list):
7979
if "asset" in output and output["asset"] == issuance_details[issuance_type]:
8080
if issuance_type+"_address" not in issuance_req:
8181
raise Exception("Found asset type not requested")
82-
if "value" in output and \
83-
output["value"] == issuance_req[issuance_type+"_amount"]:
82+
if "value" in output and output["value"] == issuance_req[issuance_type+"_amount"]:
8483
asset_found = True
8584

8685
# Find the asset type if it was created
@@ -105,7 +104,7 @@ def setup_network(self, split=False):
105104
def run_test(self):
106105
self.nodes[0].generate(105)
107106
# Make sure test starts with no initial issuance.
108-
assert_equal(len(self.nodes[0].listissuances()), 0);
107+
assert_equal(len(self.nodes[0].listissuances()), 0)
109108

110109
# Unblinded issuance of asset
111110
issued = self.nodes[0].issueasset(1, 1, False)
@@ -211,7 +210,7 @@ def run_test(self):
211210
addr2 = txdet2[len(txdet2)-1]["address"]
212211
addr3 = txdet3[len(txdet3)-1]["address"]
213212

214-
assert_equal(len(self.nodes[0].listissuances()), 5);
213+
assert_equal(len(self.nodes[0].listissuances()), 5)
215214
self.nodes[0].importaddress(addr1)
216215
self.nodes[0].importaddress(addr2)
217216
self.nodes[0].importaddress(addr3)

test/functional/feature_pak.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Distributed under the MIT/X11 software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
from test_framework.test_framework import BitcoinTestFramework
6-
from test_framework.util import assert_equal, assert_raises_rpc_error, connect_nodes_bi, sync_blocks, Decimal, BITCOIN_ASSET
6+
from test_framework.util import assert_equal, assert_raises_rpc_error, connect_nodes_bi, sync_blocks, Decimal
77
import copy
88
import time
99

test/functional/feature_rbf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from test_framework.messages import COIN, COutPoint, CTransaction, CTxIn, CTxOut, CTxOutValue
1010
from test_framework.script import CScript, OP_DROP
1111
from test_framework.test_framework import BitcoinTestFramework
12-
from test_framework.util import assert_equal, assert_raises_rpc_error, bytes_to_hex_str, hex_str_to_bytes, satoshi_round, BITCOIN_ASSET
12+
from test_framework.util import assert_equal, assert_raises_rpc_error, bytes_to_hex_str, hex_str_to_bytes, satoshi_round
1313

1414
from io import BytesIO
1515

test/functional/feature_segwit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from test_framework.messages import COIN, COutPoint, CTransaction, CTxIn, CTxOut, FromHex, sha256, ToHex
2020
from test_framework.script import CScript, OP_HASH160, OP_CHECKSIG, OP_0, hash160, OP_EQUAL, OP_DUP, OP_EQUALVERIFY, OP_1, OP_2, OP_CHECKMULTISIG, OP_TRUE, OP_DROP, OP_RETURN
2121
from test_framework.test_framework import BitcoinTestFramework
22-
from test_framework.util import assert_equal, assert_raises_rpc_error, bytes_to_hex_str, connect_nodes, hex_str_to_bytes, sync_blocks, try_rpc, BITCOIN_ASSET
22+
from test_framework.util import assert_equal, assert_raises_rpc_error, bytes_to_hex_str, connect_nodes, hex_str_to_bytes, sync_blocks, try_rpc
2323

2424
from io import BytesIO
2525

test/functional/interface_rest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
assert_greater_than,
2121
assert_greater_than_or_equal,
2222
hex_str_to_bytes,
23-
BITCOIN_ASSET,
2423
)
2524

2625
class ReqType(Enum):

0 commit comments

Comments
 (0)