11import gc
22import os
3+ import resource
34import sys
45import unittest
56
1213ns = {'dsig' : xmlsec .constants .DSigNs , 'enc' : xmlsec .constants .EncNs }
1314
1415
15- try :
16- import resource
17-
18- def get_memory_usage ():
19- return resource .getrusage (resource .RUSAGE_SELF ).ru_maxrss
20-
21- except ImportError :
22- resource = None
23-
24- def get_memory_usage ():
25- return 0
26-
27-
2816def get_iterations ():
17+ """Parse iterations amount."""
2918 if sys .platform in ('win32' ,):
3019 return 0
3120
@@ -114,9 +103,9 @@ def assertXmlEqual(self, first, second, msg=None): # noqa: N802
114103 for name in second .attrib .keys ():
115104 if name not in first .attrib :
116105 self .fail ('x2 has an attribute x1 is missing: {}. {}' .format (name , msg ))
117- if not xml_text_compare (first .text , second .text ):
106+ if not _xml_text_compare (first .text , second .text ):
118107 self .fail ('text: {!r} != {!r}. {}' .format (first .text , second .text , msg ))
119- if not xml_text_compare (first .tail , second .tail ):
108+ if not _xml_text_compare (first .tail , second .tail ):
120109 self .fail ('tail: {!r} != {!r}. {}' .format (first .tail , second .tail , msg ))
121110 cl1 = sorted (first .getchildren (), key = lambda x : x .tag )
122111 cl2 = sorted (second .getchildren (), key = lambda x : x .tag )
@@ -128,7 +117,7 @@ def assertXmlEqual(self, first, second, msg=None): # noqa: N802
128117 self .assertXmlEqual (c1 , c2 )
129118
130119
131- def xml_text_compare (t1 , t2 ):
120+ def _xml_text_compare (t1 , t2 ):
132121 if not t1 and not t2 :
133122 return True
134123 if t1 == '*' or t2 == '*' :
0 commit comments