@@ -203,25 +203,6 @@ def serialize_check(self, elem, expected):
203
203
def test_interface (self ):
204
204
# Test element tree interface.
205
205
206
- def check_string (string ):
207
- len (string )
208
- for char in string :
209
- self .assertEqual (len (char ), 1 ,
210
- msg = "expected one-character string, got %r" % char )
211
- new_string = string + ""
212
- new_string = string + " "
213
- string [:0 ]
214
-
215
- def check_mapping (mapping ):
216
- len (mapping )
217
- keys = mapping .keys ()
218
- items = mapping .items ()
219
- for key in keys :
220
- item = mapping [key ]
221
- mapping ["key" ] = "value"
222
- self .assertEqual (mapping ["key" ], "value" ,
223
- msg = "expected value string, got %r" % mapping ["key" ])
224
-
225
206
def check_element (element ):
226
207
self .assertTrue (ET .iselement (element ), msg = "not an element" )
227
208
direlem = dir (element )
@@ -231,12 +212,12 @@ def check_element(element):
231
212
self .assertIn (attr , direlem ,
232
213
msg = 'no %s visible by dir' % attr )
233
214
234
- check_string (element .tag )
235
- check_mapping (element .attrib )
215
+ self . assertIsInstance (element .tag , str )
216
+ self . assertIsInstance (element .attrib , dict )
236
217
if element .text is not None :
237
- check_string (element .text )
218
+ self . assertIsInstance (element .text , str )
238
219
if element .tail is not None :
239
- check_string (element .tail )
220
+ self . assertIsInstance (element .tail , str )
240
221
for elem in element :
241
222
check_element (elem )
242
223
0 commit comments