@@ -395,37 +395,26 @@ def testChangeAttr(self):
395395 and el .getAttribute ("spam2" ) == "bam2" )
396396 dom .unlink ()
397397
398- def testGetAttrList (self ):
398+ def testGetAttrListAndLength (self ):
399399 dom = parseString ("<abc/>" )
400400 el = dom .documentElement
401401 el .setAttribute ("spam" , "jam" )
402- self .confirm (len (el .attributes .items ()) == 1 )
402+ self .assertEqual (len (el .attributes .items ()), 1 )
403403 el .setAttribute ("foo" , "bar" )
404- self .confirm (len (el .attributes .items ()) == 2 )
405- self .confirm (('spam' , 'jam' ) in el .attributes .items ())
406- self .confirm (('foo' , 'bar' ) in el .attributes .items ())
404+ self .assertEqual (len (el .attributes .items ()), 2 )
405+ self .assertIn (('spam' , 'jam' ), el .attributes .items ())
406+ self .assertIn (('foo' , 'bar' ), el .attributes .items ())
407407 dom .unlink ()
408408
409409 def testGetAttrValues (self ):
410410 dom = parseString ("<abc/>" )
411411 el = dom .documentElement
412412 el .setAttribute ("spam" , "jam" )
413413 values = [x .value for x in el .attributes .values ()]
414- self .confirm ("jam" in values )
414+ self .assertIn ("jam" , values )
415415 el .setAttribute ("foo" , "bar" )
416416 values = [x .value for x in el .attributes .values ()]
417- self .confirm ("bar" in values )
418- dom .unlink ()
419-
420- def testGetAttrLength (self ):
421- dom = parseString ("<abc/>" )
422- el = dom .documentElement
423- el .setAttribute ("spam" , "jam" )
424- self .confirm (len (el .attributes .items ()) == 1 )
425- el .setAttribute ("foo" , "bar" )
426- self .confirm (len (el .attributes .items ()) == 2 )
427- el .removeAttribute ("foo" )
428- self .confirm (len (el .attributes .items ()) == 1 )
417+ self .assertIn ("bar" , values )
429418 dom .unlink ()
430419
431420 def testGetAttribute (self ):
@@ -632,18 +621,14 @@ def testProcessingInstruction(self):
632621 def testProcessingInstructionRepr (self ):
633622 dom = parseString ('<e><?mypi \t \n data \t \n ?></e>' )
634623 pi = dom .documentElement .firstChild
635- string1 = str (pi .nodeType )
636- string2 = repr (pi .nodeType )
637- self .assertEqual (string1 , string2 )
624+ self .assertEqual (str (pi .nodeType ), repr (pi .nodeType ))
638625
639626 def testTextRepr (self ):
640627 dom = Document ()
641628 elem = dom .createElement ('elem' )
642629 elem .appendChild (dom .createTextNode ("foo" ))
643630 el = elem .firstChild
644- string1 = str (el )
645- string2 = repr (el )
646- self .assertEqual (string1 , string2 )
631+ self .assertEqual (str (el ), repr (el ))
647632
648633 def testWriteText (self ): pass
649634
0 commit comments