Ejemplo n.º 1
0
def test_invalid_output():
    input_json = {
        'settings': {
            'outputSelection': {
                'foo.vy': ['abi', 'foobar']
            }
        }
    }
    sources = {'foo.vy': ""}
    with pytest.raises(JSONError):
        get_input_dict_output_formats(input_json, sources)
Ejemplo n.º 2
0
def test_invalid_output():
    input_json = {
        "settings": {
            "outputSelection": {
                "foo.vy": ["abi", "foobar"]
            }
        }
    }
    sources = {"foo.vy": ""}
    with pytest.raises(JSONError):
        get_input_dict_output_formats(input_json, sources)
Ejemplo n.º 3
0
def test_evm():
    input_json = {'settings': {'outputSelection': {'foo.vy': ['abi', 'evm']}}}
    sources = {'foo.vy': ""}
    expected = ['abi'] + sorted(
        v for k, v in TRANSLATE_MAP.items() if k.startswith('evm'))
    result = get_input_dict_output_formats(input_json, sources)
    assert result == {'foo.vy': expected}
Ejemplo n.º 4
0
def test_evm():
    input_json = {"settings": {"outputSelection": {"foo.vy": ["abi", "evm"]}}}
    sources = {"foo.vy": ""}
    expected = ["abi"] + sorted(
        v for k, v in TRANSLATE_MAP.items() if k.startswith("evm"))
    result = get_input_dict_output_formats(input_json, sources)
    assert result == {"foo.vy": expected}
Ejemplo n.º 5
0
def test_solc_style():
    input_json = {
        'outputSelection': {
            'foo.vy': {
                '': ['abi'],
                'foo.vy': ['ir']
            }
        }
    }
    sources = {'foo.vy': ""}
    assert get_input_dict_output_formats(input_json, sources) == {
        'foo.vy': ['abi', 'ir']
    }
Ejemplo n.º 6
0
def test_solc_style():
    input_json = {
        "settings": {
            "outputSelection": {
                "foo.vy": {
                    "": ["abi"],
                    "foo.vy": ["ir"]
                }
            }
        }
    }
    sources = {"foo.vy": ""}
    assert get_input_dict_output_formats(input_json, sources) == {
        "foo.vy": ["abi", "ir"]
    }
Ejemplo n.º 7
0
def test_no_outputs():
    with pytest.raises(KeyError):
        get_input_dict_output_formats({}, {})
Ejemplo n.º 8
0
def test_star():
    input_json = {'settings': {'outputSelection': {'*': ['*']}}}
    sources = {'foo.vy': "", 'bar.vy': ""}
    expected = sorted(TRANSLATE_MAP.values())
    result = get_input_dict_output_formats(input_json, sources)
    assert result == {'foo.vy': expected, 'bar.vy': expected}
Ejemplo n.º 9
0
def test_translate_map(output):
    input_json = {'settings': {'outputSelection': {'foo.vy': [output[0]]}}}
    sources = {'foo.vy': ""}
    assert get_input_dict_output_formats(input_json, sources) == {
        'foo.vy': [output[1]]
    }
Ejemplo n.º 10
0
def test_unknown_contract():
    input_json = {'settings': {'outputSelection': {'bar.vy': ['abi']}}}
    sources = {'foo.vy': ""}
    with pytest.raises(JSONError):
        get_input_dict_output_formats(input_json, sources)
Ejemplo n.º 11
0
def test_star():
    input_json = {"settings": {"outputSelection": {"*": ["*"]}}}
    sources = {"foo.vy": "", "bar.vy": ""}
    expected = sorted(TRANSLATE_MAP.values())
    result = get_input_dict_output_formats(input_json, sources)
    assert result == {"foo.vy": expected, "bar.vy": expected}
Ejemplo n.º 12
0
def test_translate_map(output):
    input_json = {"settings": {"outputSelection": {"foo.vy": [output[0]]}}}
    sources = {"foo.vy": ""}
    assert get_input_dict_output_formats(input_json, sources) == {
        "foo.vy": [output[1]]
    }
Ejemplo n.º 13
0
def test_unknown_contract():
    input_json = {"settings": {"outputSelection": {"bar.vy": ["abi"]}}}
    sources = {"foo.vy": ""}
    with pytest.raises(JSONError):
        get_input_dict_output_formats(input_json, sources)