test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
This commit is contained in:
parent
31607daee1
commit
6be767ae3b
1 changed files with 73 additions and 62 deletions
|
|
@ -28,6 +28,7 @@ from twisted.trial import unittest
|
|||
from twisted.internet import defer
|
||||
from twisted.words.protocols.jabber.jid import JID
|
||||
from xml.etree import cElementTree as etree
|
||||
from collections import Counter
|
||||
import re
|
||||
|
||||
|
||||
|
|
@ -48,6 +49,10 @@ class DifferentXMLException(FailTest):
|
|||
pass
|
||||
|
||||
|
||||
class DifferentListException(FailTest):
|
||||
pass
|
||||
|
||||
|
||||
class FakeSAT(object):
|
||||
"""Class to simulate a SAT instance"""
|
||||
|
||||
|
|
@ -292,3 +297,16 @@ class SatTestCase(unittest.TestCase):
|
|||
print "was expecting:\n-\n%s\n-\n\n" % etree.tostring(expected_elt, encoding='utf-8')
|
||||
print "---"
|
||||
raise DifferentXMLException
|
||||
|
||||
def assertEqualUnsortedList(self, a, b, msg):
|
||||
counter_a = Counter(a)
|
||||
counter_b = Counter(b)
|
||||
if counter_a != counter_b:
|
||||
print "---"
|
||||
print "Unsorted lists are not equals:"
|
||||
print "got : %s" % counter_a
|
||||
print "was expecting: %s" % counter_b
|
||||
if msg:
|
||||
print msg
|
||||
print "---"
|
||||
raise DifferentListException
|
||||
|
|
|
|||
Loading…
Reference in a new issue