kopia lustrzana https://github.com/micropython/micropython-lib
xmltok: Add test.
rodzic
8e19a487c5
commit
db6c6e1a55
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0"?>
|
||||
<s:Envelope
|
||||
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<s:Body>
|
||||
<u:GetConnectionTypeInfo
|
||||
xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1">
|
||||
foo bar
|
||||
baz
|
||||
|
||||
</u:GetConnectionTypeInfo>
|
||||
</s:Body>
|
||||
</s:Envelope>
|
|
@ -0,0 +1,21 @@
|
|||
import xmltok
|
||||
|
||||
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')),
|
||||
]
|
||||
|
||||
ex = iter(expected)
|
||||
for i in xmltok.tokenize(open("test.xml")):
|
||||
#print(i)
|
||||
assert i == next(ex)
|
Ładowanie…
Reference in New Issue