@@ -1144,14 +1144,9 @@ def check(p, expected, namespaces=None):
1144
1144
1145
1145
# tests from the xml specification
1146
1146
check ("*" , ['*' ])
1147
- check ("{ns}*" , ['{ns}*' ])
1148
- check ("{}*" , ['{}*' ])
1149
- check ("{*}tag" , ['{*}tag' ])
1150
- check ("{*}*" , ['{*}*' ])
1151
1147
check ("text()" , ['text' , '()' ])
1152
1148
check ("@name" , ['@' , 'name' ])
1153
1149
check ("@*" , ['@' , '*' ])
1154
- check ("@{ns}attr" , ['@' , '{ns}attr' ])
1155
1150
check ("para[1]" , ['para' , '[' , '1' , ']' ])
1156
1151
check ("para[last()]" , ['para' , '[' , 'last' , '()' , ']' ])
1157
1152
check ("*/para" , ['*' , '/' , 'para' ])
@@ -1163,19 +1158,39 @@ def check(p, expected, namespaces=None):
1163
1158
check ("//olist/item" , ['//' , 'olist' , '/' , 'item' ])
1164
1159
check ("." , ['.' ])
1165
1160
check (".//para" , ['.' , '//' , 'para' ])
1166
- check (".//{*}tag" , ['.' , '//' , '{*}tag' ])
1167
1161
check (".." , ['..' ])
1168
1162
check ("../@lang" , ['..' , '/' , '@' , 'lang' ])
1169
1163
check ("chapter[title]" , ['chapter' , '[' , 'title' , ']' ])
1170
1164
check ("employee[@secretary and @assistant]" , ['employee' ,
1171
1165
'[' , '@' , 'secretary' , '' , 'and' , '' , '@' , 'assistant' , ']' ])
1172
1166
1173
1167
# additional tests
1168
+ check ("@{ns}attr" , ['@' , '{ns}attr' ])
1174
1169
check ("{http://spam}egg" , ['{http://spam}egg' ])
1175
1170
check ("./spam.egg" , ['.' , '/' , 'spam.egg' ])
1176
1171
check (".//{http://spam}egg" , ['.' , '//' , '{http://spam}egg' ])
1172
+
1173
+ # wildcard tags
1174
+ check ("{ns}*" , ['{ns}*' ])
1175
+ check ("{}*" , ['{}*' ])
1176
+ check ("{*}tag" , ['{*}tag' ])
1177
+ check ("{*}*" , ['{*}*' ])
1178
+ check (".//{*}tag" , ['.' , '//' , '{*}tag' ])
1179
+
1180
+ # namespace prefix resolution
1177
1181
check ("./xsd:type" , ['.' , '/' , '{http://www.w3.org/2001/XMLSchema}type' ],
1178
1182
{'xsd' : 'http://www.w3.org/2001/XMLSchema' })
1183
+ check ("type" , ['{http://www.w3.org/2001/XMLSchema}type' ],
1184
+ {'' : 'http://www.w3.org/2001/XMLSchema' })
1185
+ check ("@xsd:type" , ['@' , '{http://www.w3.org/2001/XMLSchema}type' ],
1186
+ {'xsd' : 'http://www.w3.org/2001/XMLSchema' })
1187
+ check ("@type" , ['@' , 'type' ],
1188
+ {'' : 'http://www.w3.org/2001/XMLSchema' })
1189
+ check ("@{*}type" , ['@' , '{*}type' ],
1190
+ {'' : 'http://www.w3.org/2001/XMLSchema' })
1191
+ check ("@{ns}attr" , ['@' , '{ns}attr' ],
1192
+ {'' : 'http://www.w3.org/2001/XMLSchema' ,
1193
+ 'ns' : 'http://www.w3.org/2001/XMLSchema' })
1179
1194
1180
1195
def test_processinginstruction (self ):
1181
1196
# Test ProcessingInstruction directly
0 commit comments