-
Notifications
You must be signed in to change notification settings - Fork 8
/
test_main.py
67 lines (64 loc) · 2.1 KB
/
test_main.py
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
import pytest
import main
@pytest.mark.parametrize(
"test_info,expected",
[
# https://pypi.org/pypi/arclet-alconna-graia/json
(
# input:
{
"bugtrack_url": "None",
"docs_url": "None",
"download_url": "",
"home_page": "",
"project_url": "https://pypi.org/project/arclet-alconna-graia/",
"project_urls": {
"Bug Reports": "https://github.com/ArcletProject/Alconna/issues",
"Documentation": "https://arcletproject.github.io/docs/alconna/tutorial",
"Homepage": "https://github.com/ArcletProject/Alconna-Graia",
"Source": "https://github.com/ArcletProject/Alconna",
},
},
# expected:
[
(
"Bug Reports",
"https://github.com/ArcletProject/Alconna/issues",
"github.com",
),
(
"Documentation",
"https://arcletproject.github.io/docs/alconna/tutorial",
"arcletproject.github.io",
),
(
"Homepage",
"https://github.com/ArcletProject/Alconna-Graia",
"github.com",
),
(
"Source",
"https://github.com/ArcletProject/Alconna",
"github.com",
),
],
),
# https://pypi.org/pypi/0x2nac0nda/json
(
# input:
{
"bugtrack_url": None,
"docs_url": None,
"download_url": "",
"home_page": "",
"project_url": "https://pypi.org/project/0x2nac0nda/",
"project_urls": None,
},
# expected:
[],
),
],
)
def test_get_project_urls(test_info, expected) -> None:
result = main.get_project_urls(test_info)
assert result == expected