<reponame>digital-land/pipeline<filename>tests/unit/test_uri.py<gh_stars>1-10
from digital_land.log import IssueLog
from digital_land.datatype.uri import URIDataType


def test_uri_normalise():
    uri = URIDataType()
    assert uri.normalise("https://example.com/foo") == "https://example.com/foo"

    assert (
        uri.normalise("https://example.com/foo\nbar\n/baz")
        == "https://example.com/foobar/baz"
    )

    issues = IssueLog()
    assert uri.normalise("example.com", issues=issues) == ""

    issue = issues.rows.pop()
    assert issue["issue-type"] == "invalid URI"
    assert issue["value"] == "example.com"
    assert issues.rows == []

from digital_land.log import IssueLog
from digital_land.datatype.uri import URIDataType


def test_uri_normalise():
    uri = URIDataType()
    assert uri.normalise("https://example.com/foo") == "https://example.com/foo"

    assert (
        uri.normalise("https://example.com/foo\nbar\n/baz")
        == "https://example.com/foobar/baz"
    )

    issues = IssueLog()
    assert uri.normalise("example.com", issues=issues) == ""

    issue = issues.rows.pop()
    assert issue["issue-type"] == "invalid URI"
    assert issue["value"] == "example.com"
    assert issues.rows == []