@@ -395,27 +395,28 @@ def testChangeAttr(self):
395395 and el .getAttribute ("spam2" ) == "bam2" )
396396 dom .unlink ()
397397
398- def testGetAttrListAndLength (self ):
398+ def testGetAttrList (self ):
399399 dom = parseString ("<abc/>" )
400+ self .addCleanup (dom .unlink )
400401 el = dom .documentElement
401402 el .setAttribute ("spam" , "jam" )
402403 self .assertEqual (len (el .attributes .items ()), 1 )
403404 el .setAttribute ("foo" , "bar" )
404- self . assertEqual ( len ( el .attributes .items ()), 2 )
405- self .assertIn (( 'spam' , 'jam' ), el . attributes . items () )
406- self .assertIn (('foo ' , 'bar ' ), el . attributes . items () )
407- dom . unlink ( )
405+ items = el .attributes .items ()
406+ self .assertEqual ( len ( items ), 2 )
407+ self .assertIn (('spam ' , 'jam ' ), items )
408+ self . assertIn (( 'foo' , 'bar' ), items )
408409
409410 def testGetAttrValues (self ):
410411 dom = parseString ("<abc/>" )
412+ self .addCleanup (dom .unlink )
411413 el = dom .documentElement
412414 el .setAttribute ("spam" , "jam" )
413415 values = [x .value for x in el .attributes .values ()]
414416 self .assertIn ("jam" , values )
415417 el .setAttribute ("foo" , "bar" )
416418 values = [x .value for x in el .attributes .values ()]
417419 self .assertIn ("bar" , values )
418- dom .unlink ()
419420
420421 def testGetAttribute (self ):
421422 dom = Document ()
0 commit comments