Exemplo n.º 1
0
def test_split_host():
    assert split_host("example.com") == ('', 'example', 'com')
    assert split_host("www.example.com") == ('www', 'example', 'com')
    assert split_host("www.foo.bar.example.com") == ('www.foo.bar', 'example', 'com')
    assert split_host("example.ac.at") == ('', 'example', 'ac.at')

    assert split_host("example.jp") == ('', 'example', 'jp')
    assert split_host("foo.kyoto.jp") == ('', 'foo', 'kyoto.jp')

    assert split_host("foo.co.uk") == ('', 'foo', 'co.uk')
    assert split_host("foo.co.sch.uk") == ('', 'foo', 'co.sch.uk')
    assert split_host("foo.bar.co.uk") == ('foo', 'bar', 'co.uk')
    assert split_host("parliament.uk") == ('', 'parliament', 'uk')
    assert split_host("foo.parliament.uk") == ('foo', 'parliament', 'uk')

    assert split_host("example.gs.aa.no") == ('', 'example', 'gs.aa.no')

    assert split_host("例子.中国") == ('', '例子', '中国')
    assert split_host("உதாரணம்.இந்தியா") == ('', 'உதாரணம்', 'இந்தியா')

    assert split_host("192.168.1.1") == ('', '192.168.1.1', '')
    assert split_host("[::1]") == ('', '[::1]', '')
Exemplo n.º 2
0
def test_split_host__idn():
    assert split_host(u'例子.中国') == ('', u'例子', u'中国')
    assert split_host(u'உதாரணம்.இந்தியா') == ('', u'உதாரணம்', u'இந்தியா')
Exemplo n.º 3
0
def test_split_host__ip():
    assert split_host('192.168.1.1') == ('', '192.168.1.1', '')
    assert split_host('[::1]') == ('', '[::1]', '')
Exemplo n.º 4
0
def test_split_host__wildcard():
    assert split_host('foo.co.sch.uk') == ('', 'foo', 'co.sch.uk')
Exemplo n.º 5
0
def test_split_host__exception():
    assert split_host('foo.bar.kobe.jp') == ('', 'foo', 'bar.kobe.jp')
    assert split_host('city.kobe.jp') == ('', 'city', 'kobe.jp')
Exemplo n.º 6
0
def test_split_host__ip():
    assert split_host('192.168.1.1') == ('', '192.168.1.1', '')
    assert split_host('[::1]') == ('', '[::1]', '')
Exemplo n.º 7
0
def test_split_host():
    assert split_host('example.com') == ('', 'example', 'com')
    assert split_host('www.example.com') == ('www', 'example', 'com')
    assert split_host('www.foo.bar.example.com') == ('www.foo.bar', 'example', 'com')
    assert split_host('example.ac.at') == ('', 'example', 'ac.at')

    assert split_host('example.jp') == ('', 'example', 'jp')
    assert split_host('foo.kyoto.jp') == ('', 'foo', 'kyoto.jp')

    assert split_host('foo.co.uk') == ('', 'foo', 'co.uk')
    assert split_host('foo.bar.co.uk') == ('foo', 'bar', 'co.uk')
    assert split_host('parliament.uk') == ('', 'parliament', 'uk')
    assert split_host('foo.parliament.uk') == ('foo', 'parliament', 'uk')

    assert split_host('example.gs.aa.no') == ('', 'example', 'gs.aa.no')
Exemplo n.º 8
0
def test_split_host__idn():
    assert split_host(u'例子.中国') == ('', u'例子', u'中国')
    assert split_host(u'உதாரணம்.இந்தியா') == ('', u'உதாரணம்', u'இந்தியா')
Exemplo n.º 9
0
def test_split_host__exception():
    assert split_host('foo.bar.kobe.jp') == ('', 'foo', 'bar.kobe.jp')
    assert split_host('city.kobe.jp') == ('', 'city', 'kobe.jp')
Exemplo n.º 10
0
def test_split_host__wildcard():
    assert split_host('foo.co.sch.uk') == ('', 'foo', 'co.sch.uk')
Exemplo n.º 11
0
def test_split_host():
    assert split_host('example.com') == ('', 'example', 'com')
    assert split_host('www.example.com') == ('www', 'example', 'com')
    assert split_host('www.foo.bar.example.com') == ('www.foo.bar', 'example',
                                                     'com')
    assert split_host('example.ac.at') == ('', 'example', 'ac.at')

    assert split_host('example.jp') == ('', 'example', 'jp')
    assert split_host('foo.kyoto.jp') == ('', 'foo', 'kyoto.jp')

    assert split_host('foo.co.uk') == ('', 'foo', 'co.uk')
    assert split_host('foo.bar.co.uk') == ('foo', 'bar', 'co.uk')
    assert split_host('parliament.uk') == ('', 'parliament', 'uk')
    assert split_host('foo.parliament.uk') == ('foo', 'parliament', 'uk')

    assert split_host('example.gs.aa.no') == ('', 'example', 'gs.aa.no')
Exemplo n.º 12
0
def test_split_host():
    assert split_host("example.com") == ('', 'example', 'com')
    assert split_host("www.example.com") == ('www', 'example', 'com')
    assert split_host("www.foo.bar.example.com") == ('www.foo.bar', 'example',
                                                     'com')
    assert split_host("example.ac.at") == ('', 'example', 'ac.at')

    assert split_host("example.jp") == ('', 'example', 'jp')
    assert split_host("foo.kyoto.jp") == ('', 'foo', 'kyoto.jp')

    assert split_host("foo.co.uk") == ('', 'foo', 'co.uk')
    assert split_host("foo.co.sch.uk") == ('', 'foo', 'co.sch.uk')
    assert split_host("foo.bar.co.uk") == ('foo', 'bar', 'co.uk')
    assert split_host("parliament.uk") == ('', 'parliament', 'uk')
    assert split_host("foo.parliament.uk") == ('foo', 'parliament', 'uk')

    assert split_host("example.gs.aa.no") == ('', 'example', 'gs.aa.no')

    assert split_host("例子.中国") == ('', '例子', '中国')
    assert split_host("உதாரணம்.இந்தியா") == ('', 'உதாரணம்', 'இந்தியா')

    assert split_host("192.168.1.1") == ('', '192.168.1.1', '')
    assert split_host("[::1]") == ('', '[::1]', '')