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}
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}
def test_outputs(): result, _ = compile_from_input_dict(INPUT_JSON) assert sorted(result.keys()) == ['contracts/bar.vy', 'contracts/foo.vy'] assert sorted(result['contracts/bar.vy'].keys()) == sorted( TRANSLATE_MAP.values())
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}
} } } sources = {'foo.vy': ""} with pytest.raises(JSONError): get_input_dict_output_formats(input_json, sources) 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) @pytest.mark.parametrize('output', TRANSLATE_MAP.items()) 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]] } 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}
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}