Exemplo n.º 1
0
def test_select_url_custom_format():
    key = "not_available"
    urls = {}

    def format(key):
        return f"custom format for '{key}'"

    expected = format(key)

    with pytest.raises(RuntimeError) as exc_info:
        enc.select_url(urls, key, format=format)

        actual = exc_info.value.args[0]
        assert actual.endswith(expected)
Exemplo n.º 2
0
 def state_dict_url(self, framework: str) -> str:
     return enc.select_url(multi_layer_encoder_urls, framework)
Exemplo n.º 3
0
def test_select_url_not_available():
    key = "not_available"
    urls = {}

    with pytest.raises(RuntimeError):
        enc.select_url(urls, key)
Exemplo n.º 4
0
def test_select_url():
    key = "available"
    url = "https://pystiche.org"

    assert enc.select_url({key: url}, key) == url