aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/yarl/tests/test_url_cmp_and_hash.py
blob: 17c42e3566ce602fa56a12224f1730ba631accba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
from yarl import URL

# comparison and hashing


def test_ne_str():
    url = URL("http://example.com/")
    assert url != "http://example.com/"


def test_eq():
    url = URL("http://example.com/")
    assert url == URL("http://example.com/")


def test_hash():
    assert hash(URL("http://example.com/")) == hash(URL("http://example.com/"))


def test_hash_double_call():
    url = URL("http://example.com/")
    assert hash(url) == hash(url)


def test_le_less():
    url1 = URL("http://example1.com/")
    url2 = URL("http://example2.com/")

    assert url1 <= url2


def test_le_eq():
    url1 = URL("http://example.com/")
    url2 = URL("http://example.com/")

    assert url1 <= url2


def test_le_not_implemented():
    url = URL("http://example1.com/")

    assert url.__le__(123) is NotImplemented


def test_lt():
    url1 = URL("http://example1.com/")
    url2 = URL("http://example2.com/")

    assert url1 < url2


def test_lt_not_implemented():
    url = URL("http://example1.com/")

    assert url.__lt__(123) is NotImplemented


def test_ge_more():
    url1 = URL("http://example1.com/")
    url2 = URL("http://example2.com/")

    assert url2 >= url1


def test_ge_eq():
    url1 = URL("http://example.com/")
    url2 = URL("http://example.com/")

    assert url2 >= url1


def test_ge_not_implemented():
    url = URL("http://example1.com/")

    assert url.__ge__(123) is NotImplemented


def test_gt():
    url1 = URL("http://example1.com/")
    url2 = URL("http://example2.com/")

    assert url2 > url1


def test_gt_not_implemented():
    url = URL("http://example1.com/")

    assert url.__gt__(123) is NotImplemented