Exemplo n.º 1
0
def test_raw_source_compilation():
    code = solc(source=contract_source, raw=True)
    assert code == contract_compiled_raw
Exemplo n.º 2
0
def test_source_and_input_files_mutually_exclusive():
    with pytest.raises(ValueError):
        solc(source=contract_source, input_files=['someContract.sol'])
Exemplo n.º 3
0
def test_one_of_source_or_input_files_required():
    with pytest.raises(ValueError):
        solc()
Exemplo n.º 4
0
def test_raw_file_compilation():
    code = solc(input_files=["tests/solidity/projects/test-01/contracts/Example.sol"], raw=True)
    cmp_compile_data(json.loads(code), json.loads(contract_compiled_raw))
Exemplo n.º 5
0
def test_json_source_compilation():
    code = solc(source=contract_source, rich=False)
    for left, right in zip(code, contract_compiled_json):
        assert left[0] == right[0]
        cmp_compile_data(left[1], right[1])
Exemplo n.º 6
0
def test_raw_file_compilation():
    code = solc(
        input_files=["tests/solidity/projects/test-01/contracts/Example.sol"],
        raw=True)
    assert code == contract_compiled_raw
Exemplo n.º 7
0
def test_raw_source_compilation():
    code = solc(source=contract_source, raw=True)
    cmp_compile_data(json.loads(code), json.loads(contract_compiled_raw))
Exemplo n.º 8
0
def test_raw_file_compilation():
    input_file = os.path.join(this_dir,
                              "projects/test-01/contracts/Example.sol")
    code = solc(input_files=[input_file], raw=True)
    cmp_compile_data(json.loads(code), json.loads(contract_compiled_raw))
Exemplo n.º 9
0
def test_json_source_compilation():
    code = solc(source=contract_source, rich=False)
    for left, right in zip(code, contract_compiled_json):
        assert left[0] == right[0]
        cmp_compile_data(left[1], right[1])
Exemplo n.º 10
0
def test_one_of_source_or_input_files_required():
    with pytest.raises(ValueError):
        solc()
Exemplo n.º 11
0
def test_raw_source_compilation():
    code = solc(source=contract_source, raw=True)
    cmp_compile_data(json.loads(code), json.loads(contract_compiled_raw))
Exemplo n.º 12
0
def test_source_and_input_files_mutually_exclusive():
    with pytest.raises(ValueError):
        solc(source=contract_source, input_files=['someContract.sol'])
Exemplo n.º 13
0
def test_invalid_source_compilation():
    with pytest.raises(CompileError) as exception:
        solc(source=u'This is not a contract that compiles', rich=False)
    expected_error_message = u'Error: Expected import directive or contract definition'
    assert expected_error_message in str(exception)
Exemplo n.º 14
0
def test_json_source_compilation():
    code = solc(source=contract_source, rich=False)
    assert code == contract_compiled_json
Exemplo n.º 15
0
def test_raw_file_compilation():
    code = solc(input_files=["tests/solidity/projects/test-01/contracts/Example.sol"], raw=True)
    assert code == contract_compiled_raw
Exemplo n.º 16
0
def test_raw_file_compilation():
    input_file = os.path.join(this_dir, "projects/test-01/contracts/Example.sol")
    code = solc(input_files=[input_file], raw=True)
    cmp_compile_data(json.loads(code), json.loads(contract_compiled_raw))
Exemplo n.º 17
0
def test_json_source_compilation():
    code = solc(source=contract_source, rich=False)
    assert code == contract_compiled_json
Exemplo n.º 18
0
def test_raw_source_compilation():
    code = solc(source=contract_source, raw=True)
    assert code == contract_compiled_raw