示例#1
0
def test_url_canonicalizer_want_all():
    v = URLCanonicalizer(discard_parts=())
    el = scalar(u'http://*****:*****@there/path#fragment')
    eq_(el.value, u'http://*****:*****@there/path#fragment')

    assert v.validate(el, None)
    eq_(el.value, u'http://*****:*****@there/path#fragment')
    assert not el.errors
示例#2
0
def test_url_canonicalizer_default():
    v = URLCanonicalizer()
    el = scalar(u'http://localhost/#foo')
    eq_(el.value, u'http://localhost/#foo')

    assert v.validate(el, None)
    eq_(el.value, u'http://localhost/')
    assert not el.errors
示例#3
0
def test_url_canonicalizer_default():
    v = URLCanonicalizer()
    el = scalar('http://localhost/#foo')
    eq_(el.value, 'http://localhost/#foo')

    assert v.validate(el, None)
    eq_(el.value, 'http://localhost/')
    assert not el.errors
示例#4
0
def test_url_canonicalizer_want_all():
    v = URLCanonicalizer(discard_parts=())
    el = scalar('http://*****:*****@there/path#fragment')
    eq_(el.value, 'http://*****:*****@there/path#fragment')

    assert v.validate(el, None)
    eq_(el.value, 'http://*****:*****@there/path#fragment')
    assert not el.errors
示例#5
0
文件: test.py 项目: serg0987/python
def test_url_canonicalizer_want_one():
    v = URLCanonicalizer(discard_parts=_url_parts[1:])
    el = scalar("http://*****:*****@there/path#fragment")
    eq_(el.value, "http://*****:*****@there/path#fragment")

    assert v.validate(el, None)
    eq_(el.value, "http://")
    assert not el.errors