2015-10-10 10:10:11 +00:00
|
|
|
import xmltok
|
|
|
|
|
|
|
|
expected = [
|
2021-05-27 05:50:04 +00:00
|
|
|
("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")),
|
2015-10-10 10:10:11 +00:00
|
|
|
]
|
|
|
|
|
2017-08-29 21:19:13 +00:00
|
|
|
dir = "."
|
|
|
|
if "/" in __file__:
|
|
|
|
dir = __file__.rsplit("/", 1)[0]
|
|
|
|
|
2015-10-10 10:10:11 +00:00
|
|
|
ex = iter(expected)
|
2017-08-29 21:19:13 +00:00
|
|
|
for i in xmltok.tokenize(open(dir + "/test.xml")):
|
2021-05-27 05:50:04 +00:00
|
|
|
# print(i)
|
2015-10-10 10:10:11 +00:00
|
|
|
assert i == next(ex)
|