-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_data.py
More file actions
163 lines (133 loc) · 3.77 KB
/
test_data.py
File metadata and controls
163 lines (133 loc) · 3.77 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
"""
Copyright (c) 2025, binary butterfly GmbH
Use of this source code is governed by an MIT-style license that can be found in the LICENSE.txt.
"""
from typing import List, Tuple
from lxml import etree
xml_string_example_1: str = """
<Envelope>
<Header>
<Security>
<UsernameToken>
<Username>Ghost</Username>
<Password>Boo</Password>
</UsernameToken>
</Security>
</Header>
<Body>
<Content>
<ContentText>
<Text>some text</Text>
</ContentText>
</Content>
</Body>
</Envelope>
"""
xml_etree_example_1: etree.Element = etree.fromstring(xml_string_example_1) # noqa: S320
xml_dict_example_1: dict = {
'Envelope': {
'Body': {
'Content': {
'ContentText': {
'Text': 'some text',
}
}
},
'Header': {
'Security': {
'UsernameToken': {
'Password': 'Boo',
'Username': 'Ghost',
}
}
},
}
}
remote_type_tags_1a: List[str] = ['Content', 'ContentText', 'Text', 'Security', 'UsernameToken']
xml_dict_example_1a: dict = {
'Envelope': {
'Body': 'some text',
'Header': {
'Password': 'Boo',
'Username': 'Ghost',
},
}
}
remote_type_tags_1b: List[str] = ['Envelope', 'Content', 'ContentText', 'Text', 'Security', 'UsernameToken']
xml_dict_example_1b: dict = {
'Body': 'some text',
'Header': {
'Password': 'Boo',
'Username': 'Ghost',
},
}
ensure_array_keys_1c: List[Tuple[str, str]] = [('Envelope', 'Header'), ('Content', 'ContentText')]
xml_dict_example_1c: dict = {
'Envelope': {
'Body': {
'Content': {
'ContentText': [
{'Text': 'some text'},
]
}
},
'Header': [
{'Security': {'UsernameToken': {'Password': 'Boo', 'Username': 'Ghost'}}},
],
}
}
xml_string_example_2: str = """
<status>
<ChargePointStatusType>Operative</ChargePointStatusType>
</status>
"""
xml_etree_example_2: etree.Element = etree.fromstring(xml_string_example_2) # noqa: S320
xml_dict_example_2: dict = {
'status': {
'ChargePointStatusType': 'Operative',
}
}
remote_type_tags_2a: List[str] = ['ChargePointStatusType']
conditional_remote_type_tags_2a: List[Tuple[str, str]] = [('status', 'ChargePointStatusType')]
xml_dict_example_2a: dict = {
'status': 'Operative',
}
xml_string_example_3: str = """
<resultCode>
<resultCode>ok</resultCode>
</resultCode>
"""
xml_etree_example_3: etree.Element = etree.fromstring(xml_string_example_3) # noqa: S320
xml_dict_example_3: dict = {
'resultCode': {
'resultCode': 'ok',
}
}
conditional_remote_type_tags_3a: List[Tuple[str, str]] = [('resultCode', 'resultCode')]
xml_dict_example_3a: dict = {
'resultCode': 'ok',
}
xml_string_example_4: str = """
<resultDescription xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
"""
xml_etree_example_4: etree.Element = etree.fromstring(xml_string_example_4) # noqa: S320
ignore_attributes_4: List[str] = ['{http://www.w3.org/2001/XMLSchema-instance}nil']
xml_dict_example_4: dict = {
'resultDescription': None,
}
xml_string_example_5: str = """
<topLevelTag class="testClass">
testText
<secondLevelTag>ok</secondLevelTag>
<class>anotherTestClass</class>
</topLevelTag>
"""
xml_etree_example_5: etree.Element = etree.fromstring(xml_string_example_5) # noqa: S320
xml_dict_example_5: dict = {
'topLevelTag': {
'_text': 'testText',
'class': 'testClass',
'class_': 'anotherTestClass',
'secondLevelTag': 'ok',
}
}