forked from micropython/micropython-lib
- Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_xmltok.py
25 lines (22 loc) · 783 Bytes
/
test_xmltok.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
importxmltok
expected= [
("PI", "xml"),
("ATTR", ("", "version"), "1.0"),
("START_TAG", ("s", "Envelope")),
("ATTR", ("xmlns", "s"), "http://schemas.xmlsoap.org/soap/envelope/"),
("ATTR", ("s", "encodingStyle"), "http://schemas.xmlsoap.org/soap/encoding/"),
("START_TAG", ("s", "Body")),
("START_TAG", ("u", "GetConnectionTypeInfo")),
("ATTR", ("xmlns", "u"), "urn:schemas-upnp-org:service:WANIPConnection:1"),
("TEXT", "foo bar\n baz\n\n"),
("END_TAG", ("u", "GetConnectionTypeInfo")),
("END_TAG", ("s", "Body")),
("END_TAG", ("s", "Envelope")),
]
dir="."
if"/"in__file__:
dir=__file__.rsplit("/", 1)[0]
ex=iter(expected)
foriinxmltok.tokenize(open(dir+"/test.xml")):
# print(i)
asserti==next(ex)