import pytest
import urllib.error
from urlpathlib import UrlPath


def test_scheme():

    # does not raise NotImplementedError
    UrlPath('/dev/null').touch()


def test_scheme_not_supported():

    with pytest.raises(NotImplementedError):
        UrlPath('http:///tmp/test').touch()


def test_scheme_not_listed():

    with pytest.raises(NotImplementedError):
        UrlPath('test:///tmp/test').touch()


def test_file_additional():

    assert UrlPath('.').resolve() == UrlPath.cwd()


def test_scheme_alias():

    # does not raise NotImplementedError
    with pytest.raises(urllib.error.URLError):
        UrlPath('https://localhost/test').exists()
