@@ -395,37 +395,26 @@ def testChangeAttr(self):
395
395
and el .getAttribute ("spam2" ) == "bam2" )
396
396
dom .unlink ()
397
397
398
- def testGetAttrList (self ):
398
+ def testGetAttrListAndLength (self ):
399
399
dom = parseString ("<abc/>" )
400
400
el = dom .documentElement
401
401
el .setAttribute ("spam" , "jam" )
402
- self .confirm (len (el .attributes .items ()) == 1 )
402
+ self .assertEqual (len (el .attributes .items ()), 1 )
403
403
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 ())
407
407
dom .unlink ()
408
408
409
409
def testGetAttrValues (self ):
410
410
dom = parseString ("<abc/>" )
411
411
el = dom .documentElement
412
412
el .setAttribute ("spam" , "jam" )
413
413
values = [x .value for x in el .attributes .values ()]
414
- self .confirm ("jam" in values )
414
+ self .assertIn ("jam" , values )
415
415
el .setAttribute ("foo" , "bar" )
416
416
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 )
429
418
dom .unlink ()
430
419
431
420
def testGetAttribute (self ):
@@ -632,18 +621,14 @@ def testProcessingInstruction(self):
632
621
def testProcessingInstructionRepr (self ):
633
622
dom = parseString ('<e><?mypi \t \n data \t \n ?></e>' )
634
623
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 ))
638
625
639
626
def testTextRepr (self ):
640
627
dom = Document ()
641
628
elem = dom .createElement ('elem' )
642
629
elem .appendChild (dom .createTextNode ("foo" ))
643
630
el = elem .firstChild
644
- string1 = str (el )
645
- string2 = repr (el )
646
- self .assertEqual (string1 , string2 )
631
+ self .assertEqual (str (el ), repr (el ))
647
632
648
633
def testWriteText (self ): pass
649
634
0 commit comments