From 75c0f1ac16465631086008413c3a08de1b7c2edc Mon Sep 17 00:00:00 2001 From: Nikhil Parasaram Date: Sat, 24 Nov 2018 23:15:45 +0530 Subject: [PATCH] Reformat code with black --- tests/cmd_line_test.py | 4 +++- .../laser/transaction/create_transaction_test.py | 10 ++++++++-- tests/native_test.py | 4 +++- tests/solidity_contract_test.py | 16 +++++++++++++--- tests/svm_test.py | 4 +++- 5 files changed, 30 insertions(+), 8 deletions(-) diff --git a/tests/cmd_line_test.py b/tests/cmd_line_test.py index c875ffd8..c346323f 100644 --- a/tests/cmd_line_test.py +++ b/tests/cmd_line_test.py @@ -15,7 +15,9 @@ class CommandLineToolTestCase(BaseTestCase): output_of(command) def test_disassemble_code_correctly(self): - command = "python3 {} MYTH -d --bin-runtime -c 0x5050 --solv 0.4.24".format(MYTH) + command = "python3 {} MYTH -d --bin-runtime -c 0x5050 --solv 0.4.24".format( + MYTH + ) self.assertEqual("0 POP\n1 POP\n", output_of(command)) def test_disassemble_solidity_file_correctly(self): diff --git a/tests/laser/transaction/create_transaction_test.py b/tests/laser/transaction/create_transaction_test.py index 4281378d..643e9efb 100644 --- a/tests/laser/transaction/create_transaction_test.py +++ b/tests/laser/transaction/create_transaction_test.py @@ -11,7 +11,10 @@ from mythril.analysis.symbolic import SymExecWrapper def test_create(): - contract = SolidityContract(str(tests.TESTDATA_INPUTS_CONTRACTS / "calls.sol"), solc_binary=Mythril._init_solc_binary('0.4.24')) + contract = SolidityContract( + str(tests.TESTDATA_INPUTS_CONTRACTS / "calls.sol"), + solc_binary=Mythril._init_solc_binary("0.4.24"), + ) laser_evm = svm.LaserEVM({}) @@ -32,7 +35,10 @@ def test_create(): def test_sym_exec(): - contract = SolidityContract(str(tests.TESTDATA_INPUTS_CONTRACTS / "calls.sol"), solc_binary=Mythril._init_solc_binary('0.4.24')) + contract = SolidityContract( + str(tests.TESTDATA_INPUTS_CONTRACTS / "calls.sol"), + solc_binary=Mythril._init_solc_binary("0.4.24"), + ) sym = SymExecWrapper( contract, address=(util.get_indexed_address(0)), strategy="dfs" diff --git a/tests/native_test.py b/tests/native_test.py index 81ca6a4f..22e4e3a9 100644 --- a/tests/native_test.py +++ b/tests/native_test.py @@ -110,7 +110,9 @@ class NativeTests(BaseTestCase): @staticmethod def runTest(): - disassembly = SolidityContract("./tests/native_tests.sol", solc_binary=Mythril._init_solc_binary('0.4.24')).disassembly + disassembly = SolidityContract( + "./tests/native_tests.sol", solc_binary=Mythril._init_solc_binary("0.4.24") + ).disassembly account = Account("0x0000000000000000000000000000000000000000", disassembly) accounts = {account.address: account} diff --git a/tests/solidity_contract_test.py b/tests/solidity_contract_test.py index 736309a8..7d72db90 100644 --- a/tests/solidity_contract_test.py +++ b/tests/solidity_contract_test.py @@ -10,7 +10,9 @@ TEST_FILES = Path(__file__).parent / "testdata/input_contracts" class SolidityContractTest(BaseTestCase): def test_get_source_info_without_name_gets_latest_contract_info(self): input_file = TEST_FILES / "multi_contracts.sol" - contract = SolidityContract(str(input_file), solc_binary=Mythril._init_solc_binary('0.4.24')) + contract = SolidityContract( + str(input_file), solc_binary=Mythril._init_solc_binary("0.4.24") + ) code_info = contract.get_source_info(142) @@ -20,7 +22,11 @@ class SolidityContractTest(BaseTestCase): def test_get_source_info_with_contract_name_specified(self): input_file = TEST_FILES / "multi_contracts.sol" - contract = SolidityContract(str(input_file), name="Transfer1", solc_binary=Mythril._init_solc_binary('0.4.24')) + contract = SolidityContract( + str(input_file), + name="Transfer1", + solc_binary=Mythril._init_solc_binary("0.4.24"), + ) code_info = contract.get_source_info(142) @@ -30,7 +36,11 @@ class SolidityContractTest(BaseTestCase): def test_get_source_info_with_contract_name_specified_constructor(self): input_file = TEST_FILES / "constructor_assert.sol" - contract = SolidityContract(str(input_file), name="AssertFail", solc_binary=Mythril._init_solc_binary('0.4.24')) + contract = SolidityContract( + str(input_file), + name="AssertFail", + solc_binary=Mythril._init_solc_binary("0.4.24"), + ) code_info = contract.get_source_info(62, constructor=True) diff --git a/tests/svm_test.py b/tests/svm_test.py index 1fdc3bd7..e2f31a91 100644 --- a/tests/svm_test.py +++ b/tests/svm_test.py @@ -83,7 +83,9 @@ class SVMTestCase(BaseTestCase): input_file.name + ".json" ) - disassembly = SolidityContract(str(input_file), solc_binary=Mythril._init_solc_binary('0.4.24')).disassembly + disassembly = SolidityContract( + str(input_file), solc_binary=Mythril._init_solc_binary("0.4.24") + ).disassembly account = Account("0x0000000000000000000000000000000000000000", disassembly) accounts = {account.address: account}