This repository has been archived by the owner on Jun 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_gdp.py
82 lines (72 loc) · 2.61 KB
/
test_gdp.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
from unittest import TestCase
from gdp import KotlinFormat, NormalFormat, ShortFormat, main
class TestNormalFormat(TestCase):
def test_parse(self):
normal_format = NormalFormat()
deps = normal_format.parse(
"compile group: 'com.google.firebase', name: 'firebase-core', version: '17.2.1'"
)
assert deps[0]["type"] == "compile"
assert deps[0]["group"] == "com.google.firebase"
assert deps[0]["name"] == "firebase-core"
assert deps[0]["version"] == "17.2.1"
def test_format_output(self):
normal_format = NormalFormat()
text = normal_format.format_output(
{
"type": "compile",
"group": "com.google.firebase",
"name": "firebase-core",
"version": "17.2.1",
}
)
self.assertEqual(
text,
"compile group: 'com.google.firebase', name: 'firebase-core', version: '17.2.1'",
)
class TestShortFormat(TestCase):
def test_parse(self):
short_format = ShortFormat()
deps = short_format.parse(
"api 'com.google.firebase:firebase-core:17.2.1'"
)
assert deps[0]["type"] == "api"
assert deps[0]["group"] == "com.google.firebase"
assert deps[0]["name"] == "firebase-core"
assert deps[0]["version"] == "17.2.1"
def test_format_output(self):
short_format = ShortFormat()
text = short_format.format_output(
{
"type": "api",
"group": "com.google.firebase",
"name": "firebase-core",
"version": "17.2.1",
}
)
self.assertEqual(
text, "api 'com.google.firebase:firebase-core:17.2.1'"
)
class TestKotlinFormat(TestCase):
def test_parse(self):
kotlin_format = KotlinFormat()
deps = kotlin_format.parse(
"implementation('com.google.firebase:firebase-core:17.2.1')"
)
assert deps[0]["type"] == "implementation"
assert deps[0]["group"] == "com.google.firebase"
assert deps[0]["name"] == "firebase-core"
assert deps[0]["version"] == "17.2.1"
def test_format_output(self):
kotlin_format = KotlinFormat()
deps = kotlin_format.format_output(
{
"type": "implementation",
"group": "com.google.firebase",
"name": "firebase-core",
"version": "17.2.1",
}
)
self.assertEqual(
deps, "implementation('com.google.firebase:firebase-core:17.2.1')"
)