Esempio n. 1
0
def test_uri_empty_port_is_0():
    uri = URI("://foobar:[email protected]:8080/baz.html?buz=bloo")
    assert uri.port == 0, uri.port
Esempio n. 2
0
def test_uri_empty_password_is_empty_unicode():
    uri = URI("http://foobar:@www.example.com:8080/baz.html?buz=bloo")
    assert uri.password == u"", uri.password
    assert isinstance(uri.password, unicode), uri.password.__class__
Esempio n. 3
0
def test_uri_empty_host_is_empty_unicode():
    uri = URI("http://*****:*****@:8080/baz.html?buz=bloo")
    assert uri.host == u"", uri.host
    assert isinstance(uri.host, unicode), uri.host.__class__
Esempio n. 4
0
def test_a_nice_unicode_uri():
    uri = URI("http://%E2%98%84:bar@localhost:5370/+%E2%98%84.html?%E2%98%84=%E2%98%84+bar")
    assert uri == "http://%E2%98%84:bar@localhost:5370/+%E2%98%84.html?%E2%98%84=%E2%98%84+bar", uri
Esempio n. 5
0
def test_uri_empty_username_is_empty_unicode():
    uri = URI("http://:[email protected]:8080/baz.html?buz=bloo")
    assert uri.username == u"", uri.username
    assert isinstance(uri.username, unicode), uri.username.__class__
Esempio n. 6
0
def test_uri_encoded_username_is_unencoded_properly():
    uri = URI("http://%e2%98%84:[email protected]/foo.html")
    assert uri.username == u'\u2604', uri.username
Esempio n. 7
0
def test_uri_international_domain_name_comes_out_properly():
    uri = URI("http://www.xn--cev.tk/foo.html")
    assert uri.host == u'www.\u658b.tk', uri.host
Esempio n. 8
0
def test_uri_sets_querystring():
    uri = URI("http://*****:*****@www.example.com:8080/baz.html?buz=bloo")
    assert uri.querystring.decoded == u"buz=bloo", uri.querystring.decoded
Esempio n. 9
0
def test_uri_host_is_unicode():
    uri = URI("http://*****:*****@www.example.com:8080/baz.html?buz=bloo")
    assert isinstance(uri.host, unicode)
Esempio n. 10
0
def test_uri_sets_port():
    uri = URI("http://*****:*****@www.example.com:8080/baz.html?buz=bloo")
    assert uri.port == 8080, uri.port
Esempio n. 11
0
def test_uri_sets_path():
    uri = URI("http://*****:*****@www.example.com:8080/baz.html?buz=bloo")
    assert uri.path.decoded == u"/baz.html", uri.path.decoded
Esempio n. 12
0
def test_uri_sets_host():
    uri = URI("http://*****:*****@www.example.com:8080/baz.html?buz=bloo")
    assert uri.host == u"www.example.com", uri.host
Esempio n. 13
0
def test_uri_sets_password():
    uri = URI("http://*****:*****@www.example.com:8080/baz.html?buz=bloo")
    assert uri.password == u"secret", uri.password
Esempio n. 14
0
def test_uri_sets_username():
    uri = URI("http://*****:*****@www.example.com:8080/baz.html?buz=bloo")
    assert uri.username == u"foobar", uri.username
Esempio n. 15
0
def test_uri_normal_case_is_normal():
    uri = URI("/baz.html?buz=bloo")
    assert uri.path == Path("/baz.html")
    assert uri.querystring == Querystring("buz=bloo")
Esempio n. 16
0
def test_uri_port_is_int():
    uri = URI("http://*****:*****@www.example.com:8080/baz.html?buz=bloo")
    assert isinstance(uri.port, int)
Esempio n. 17
0
def test_uri_ASCII_worketh():
    uri = URI(chr(127))
    assert uri == unichr(127), uri
Esempio n. 18
0
def test_uri_querystring_is_Mapping():
    uri = URI("http://*****:*****@www.example.com:8080/baz.html?buz=bloo")
    assert isinstance(uri.querystring, Mapping)
Esempio n. 19
0
def test_uri_encoded_password_is_unencoded_properly():
    uri = URI("http://*****:*****@www.example.com/foo.html")
    assert uri.password == u'\u2604', uri.password
Esempio n. 20
0
def test_uri_empty_scheme_is_empty_unicode():
    uri = URI("://foobar:[email protected]:8080/baz.html?buz=bloo")
    assert uri.scheme == u"", uri.scheme
    assert isinstance(uri.scheme, unicode), uri.scheme.__class__
Esempio n. 21
0
def test_uri_raw_is_available_on_something():
    uri = URI("http://www.xn--cev.tk/")
    assert uri.host.raw == "www.xn--cev.tk", uri.host.raw
Esempio n. 22
0
def test_uri_works_at_all():
    uri = URI("/")
    expected = u"/"
    actual = uri
    assert actual == expected, actual