@@ -281,7 +281,7 @@ def testAddAttr(self):
281281 child = dom .appendChild (dom .createElement ("abc" ))
282282
283283 child .setAttribute ("def" , "ghi" )
284- self .assertEqual (child .getAttribute ("def" ),"ghi" )
284+ self .assertEqual (child .getAttribute ("def" ), "ghi" )
285285 self .assertEqual (child .attributes ["def" ].value , "ghi" )
286286
287287 child .setAttribute ("jkl" , "mno" )
@@ -342,7 +342,7 @@ def testRemoveAttributeNode(self):
342342 self .assertRaises (xml .dom .NotFoundErr , child .removeAttributeNode ,
343343 None )
344344 self .assertIs (node , child .removeAttributeNode (node ))
345- self .assertEqual (len (child .attributes ), 0
345+ self .confirm (len (child .attributes ) == 0
346346 and child .getAttributeNode ("spam" ) is None )
347347 dom2 = Document ()
348348 child2 = dom2 .appendChild (dom2 .createElement ("foo" ))
@@ -695,7 +695,8 @@ def _testCloneElementCopiesAttributes(self, e1, e2, test):
695695 keys2 = list (attrs2 .keys ())
696696 keys1 .sort ()
697697 keys2 .sort ()
698- self .assertEqual (keys1 , keys2 , "clone of element has same attribute keys" )
698+ self .assertEqual (keys1 , keys2 ,
699+ "clone of element has same attribute keys" )
699700 for i in range (len (keys1 )):
700701 a1 = attrs1 .item (i )
701702 a2 = attrs2 .item (i )
@@ -746,7 +747,7 @@ def testCloneDocumentShallow(self):
746747 "]>\n "
747748 "<doc attr='value'/>" )
748749 doc2 = doc .cloneNode (0 )
749- self .assertIs (doc2 , None ,
750+ self .assertIsNone (doc2 ,
750751 "testCloneDocumentShallow:"
751752 " shallow cloning of documents makes no sense!" )
752753
@@ -812,7 +813,7 @@ def testCloneDocumentTypeDeepOk(self):
812813 def testCloneDocumentTypeDeepNotOk (self ):
813814 doc = create_doc_with_doctype ()
814815 clone = doc .doctype .cloneNode (1 )
815- self .assertIs (clone , None , "testCloneDocumentTypeDeepNotOk" )
816+ self .assertIsNone (clone , "testCloneDocumentTypeDeepNotOk" )
816817
817818 def testCloneDocumentTypeShallowOk (self ):
818819 doctype = create_nonempty_doctype ()
@@ -831,7 +832,7 @@ def testCloneDocumentTypeShallowOk(self):
831832 def testCloneDocumentTypeShallowNotOk (self ):
832833 doc = create_doc_with_doctype ()
833834 clone = doc .doctype .cloneNode (0 )
834- self .assertIs (clone , None , "testCloneDocumentTypeShallowNotOk" )
835+ self .assertIsNone (clone )
835836
836837 def check_import_document (self , deep , testName ):
837838 doc1 = parseString ("<doc/>" )
@@ -861,11 +862,11 @@ def testImportDocumentTypeDeep(self):
861862 def check_clone_attribute (self , deep , testName ):
862863 doc = parseString ("<doc attr='value'/>" )
863864 attr = doc .documentElement .getAttributeNode ("attr" )
864- self .assertNotEqual (attr , None )
865+ self .assertIsNotNone (attr )
865866 clone = attr .cloneNode (deep )
866867 self .assertFalse (clone .isSameNode (attr ))
867868 self .assertFalse (attr .isSameNode (clone ))
868- self .assertIs (clone .ownerElement , None ,
869+ self .assertIsNone (clone .ownerElement ,
869870 testName + ": ownerElement should be None" )
870871 self .confirm (clone .ownerDocument .isSameNode (attr .ownerDocument ),
871872 testName + ": ownerDocument does not match" )
@@ -1142,7 +1143,7 @@ def testBug1433694(self):
11421143 node = doc .documentElement
11431144 node .childNodes [1 ].nodeValue = ""
11441145 node .normalize ()
1145- self .assertIs (node .childNodes [- 1 ].nextSibling , None ,
1146+ self .assertIsNone (node .childNodes [- 1 ].nextSibling ,
11461147 "Final child's .nextSibling should be None" )
11471148
11481149 def testSiblings (self ):
@@ -1235,15 +1236,15 @@ def handle(self, operation, key, data, src, dst):
12351236 def testUserData (self ):
12361237 dom = Document ()
12371238 n = dom .createElement ('e' )
1238- self .assertIs (n .getUserData ("foo" ), None )
1239+ self .assertIsNone (n .getUserData ("foo" ))
12391240 n .setUserData ("foo" , None , None )
1240- self .assertIs (n .getUserData ("foo" ), None )
1241+ self .assertIsNone (n .getUserData ("foo" ))
12411242 n .setUserData ("foo" , 12 , 12 )
12421243 n .setUserData ("bar" , 13 , 13 )
12431244 self .assertEqual (n .getUserData ("foo" ), 12 )
12441245 self .assertEqual (n .getUserData ("bar" ), 13 )
12451246 n .setUserData ("foo" , None , None )
1246- self .assertIs (n .getUserData ("foo" ), None )
1247+ self .assertIsNone (n .getUserData ("foo" ))
12471248 self .assertEqual (n .getUserData ("bar" ), 13 )
12481249
12491250 handler = self .UserDataHandler ()
@@ -1562,7 +1563,7 @@ def testSetIdAttributeNS(self):
15621563 self .assertFalse (a1 .isId )
15631564 self .assertTrue (a2 .isId )
15641565 self .assertFalse (a3 .isId )
1565- self .assertIs (doc .getElementById ("v" ), None )
1566+ self .assertIsNone (doc .getElementById ("v" ))
15661567 # renaming an attribute should not affect its ID-ness:
15671568 doc .renameNode (a2 , xml .dom .EMPTY_NAMESPACE , "an" )
15681569 self .confirm (e .isSameNode (doc .getElementById ("w" ))
@@ -1598,7 +1599,7 @@ def testSetIdAttributeNode(self):
15981599 self .assertFalse (a1 .isId )
15991600 self .assertTrue (a2 .isId )
16001601 self .assertFalse (a3 .isId )
1601- self .assertIs (doc .getElementById ("v" ), None )
1602+ self .assertIsNone (doc .getElementById ("v" ))
16021603 # renaming an attribute should not affect its ID-ness:
16031604 doc .renameNode (a2 , xml .dom .EMPTY_NAMESPACE , "an" )
16041605 self .confirm (e .isSameNode (doc .getElementById ("w" ))
0 commit comments