def testClear(self): """Test clearing a stanza.""" stanza = StanzaBase() stanza['to'] = '*****@*****.**' stanza['payload'] = ET.Element("{foo}foo") stanza.clear() self.assertTrue(stanza['payload'] == [], "Stanza payload was not cleared after calling .clear()") self.assertTrue(str(stanza['to']) == "*****@*****.**", "Stanza attributes were not preserved after calling .clear()")
def testClear(self): """Test clearing a stanza.""" stanza = StanzaBase() stanza["to"] = "*****@*****.**" stanza["payload"] = ET.Element("{foo}foo") stanza.clear() self.failUnless(stanza["payload"] == [], "Stanza payload was not cleared after calling .clear()") self.failUnless( str(stanza["to"]) == "*****@*****.**", "Stanza attributes were not preserved after calling .clear()" )