1
1
import gc
2
2
import os
3
+ import resource
3
4
import sys
4
5
import unittest
5
6
12
13
ns = {'dsig' : xmlsec .constants .DSigNs , 'enc' : xmlsec .constants .EncNs }
13
14
14
15
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
-
28
16
def get_iterations ():
17
+ """Parse iterations amount."""
29
18
if sys .platform in ('win32' ,):
30
19
return 0
31
20
@@ -114,9 +103,9 @@ def assertXmlEqual(self, first, second, msg=None): # noqa: N802
114
103
for name in second .attrib .keys ():
115
104
if name not in first .attrib :
116
105
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 ):
118
107
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 ):
120
109
self .fail ('tail: {!r} != {!r}. {}' .format (first .tail , second .tail , msg ))
121
110
cl1 = sorted (first .getchildren (), key = lambda x : x .tag )
122
111
cl2 = sorted (second .getchildren (), key = lambda x : x .tag )
@@ -128,7 +117,7 @@ def assertXmlEqual(self, first, second, msg=None): # noqa: N802
128
117
self .assertXmlEqual (c1 , c2 )
129
118
130
119
131
- def xml_text_compare (t1 , t2 ):
120
+ def _xml_text_compare (t1 , t2 ):
132
121
if not t1 and not t2 :
133
122
return True
134
123
if t1 == '*' or t2 == '*' :
0 commit comments