Reformat code with black

pull/753/head
Nikhil Parasaram 6 years ago
parent b1ef2953d7
commit 75c0f1ac16
  1. 4
      tests/cmd_line_test.py
  2. 10
      tests/laser/transaction/create_transaction_test.py
  3. 4
      tests/native_test.py
  4. 16
      tests/solidity_contract_test.py
  5. 4
      tests/svm_test.py

@ -15,7 +15,9 @@ class CommandLineToolTestCase(BaseTestCase):
output_of(command) output_of(command)
def test_disassemble_code_correctly(self): 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)) self.assertEqual("0 POP\n1 POP\n", output_of(command))
def test_disassemble_solidity_file_correctly(self): def test_disassemble_solidity_file_correctly(self):

@ -11,7 +11,10 @@ from mythril.analysis.symbolic import SymExecWrapper
def test_create(): 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({}) laser_evm = svm.LaserEVM({})
@ -32,7 +35,10 @@ def test_create():
def test_sym_exec(): 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( sym = SymExecWrapper(
contract, address=(util.get_indexed_address(0)), strategy="dfs" contract, address=(util.get_indexed_address(0)), strategy="dfs"

@ -110,7 +110,9 @@ class NativeTests(BaseTestCase):
@staticmethod @staticmethod
def runTest(): 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) account = Account("0x0000000000000000000000000000000000000000", disassembly)
accounts = {account.address: account} accounts = {account.address: account}

@ -10,7 +10,9 @@ TEST_FILES = Path(__file__).parent / "testdata/input_contracts"
class SolidityContractTest(BaseTestCase): class SolidityContractTest(BaseTestCase):
def test_get_source_info_without_name_gets_latest_contract_info(self): def test_get_source_info_without_name_gets_latest_contract_info(self):
input_file = TEST_FILES / "multi_contracts.sol" 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) code_info = contract.get_source_info(142)
@ -20,7 +22,11 @@ class SolidityContractTest(BaseTestCase):
def test_get_source_info_with_contract_name_specified(self): def test_get_source_info_with_contract_name_specified(self):
input_file = TEST_FILES / "multi_contracts.sol" 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) 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): def test_get_source_info_with_contract_name_specified_constructor(self):
input_file = TEST_FILES / "constructor_assert.sol" 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) code_info = contract.get_source_info(62, constructor=True)

@ -83,7 +83,9 @@ class SVMTestCase(BaseTestCase):
input_file.name + ".json" 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) account = Account("0x0000000000000000000000000000000000000000", disassembly)
accounts = {account.address: account} accounts = {account.address: account}

Loading…
Cancel
Save