Skip to content

Commit dce7554

Browse files
committed
Format for pep8 and linters
Fix max min nameclash
1 parent b5caab9 commit dce7554

26 files changed

+763
-795
lines changed

src/tests/leaktest.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ def end_test(self):
4343
end = System.Environment.WorkingSet
4444
diff = end - start
4545
if diff > 0:
46-
diff = '+%d' % diff
46+
diff = '+{0}'.format(diff)
4747
else:
48-
diff = '%d' % diff
49-
print(" start: %d end: %d diff: %s" % (start, end, diff))
48+
diff = '{0}'.format(diff)
49+
print(" start: {0} end: {1} diff: {2}".format(start, end, diff))
5050
print("")
5151

5252
def run(self):
@@ -203,10 +203,10 @@ def test_events(self):
203203
testob.PublicEvent -= EventTest.StaticHandler
204204

205205
# Function event handler
206-
dict = {'value': None}
206+
dict_ = {'value': None}
207207

208-
def handler(sender, args, dict=dict):
209-
dict['value'] = args.value
208+
def handler(sender, args, dict_=dict_):
209+
dict_['value'] = args.value
210210

211211
testob.PublicEvent += handler
212212
testob.PublicEvent(testob, TestEventArgs(10))

src/tests/profile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ def main():
2626
start = time.clock()
2727

2828
for i in range(50):
29-
print('iteration: %d' % i)
29+
print('iteration: {0:d}'.format(i))
3030
runtests.main()
3131

3232
stop = time.clock()
3333
took = str(stop - start)
34-
print('Total Time: %s' % took)
34+
print('Total Time: {0}'.format(took))
3535

3636
for item in gc.get_objects():
3737
print(item, sys.getrefcount(item))

src/tests/runtests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
def remove_pyc():
5959
path = os.path.dirname(os.path.abspath(__file__))
6060
for name in test_modules:
61-
pyc = os.path.join(path, "%s.pyc" % name)
61+
pyc = os.path.join(path, "{0}.pyc".format(name))
6262
if os.path.isfile(pyc):
6363
os.unlink(pyc)
6464

src/tests/stress.py

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@
1818
import time
1919

2020
from _compat import range, thread
21-
22-
23-
def dprint(msg):
24-
# Debugging helper to trace thread-related tests.
25-
if 1:
26-
print(msg)
21+
from utils import dprint
2722

2823

2924
class StressTest(object):
@@ -35,47 +30,47 @@ def __init__(self):
3530
self.module = runtests
3631
self.done = []
3732

38-
def markStart(self):
33+
def mark_start(self):
3934
self._start = time.clock()
4035

41-
def markFinish(self):
36+
def mark_finish(self):
4237
self._finish = time.clock()
4338

4439
def elapsed(self):
4540
return self._finish - self._start
4641

47-
def printGCReport(self):
42+
def print_gc_report(self):
4843
for item in gc.get_objects():
4944
print(item, sys.getrefcount(item))
5045

51-
def runThread(self, iterations):
46+
def run_thread(self, iterations):
5247
thread_id = thread.get_ident()
53-
dprint("thread %s starting..." % thread_id)
48+
dprint("thread {0} starting...".format(thread_id))
5449
time.sleep(0.1)
5550
for i in range(iterations):
56-
dprint("thread %s iter %d start" % (thread_id, i))
51+
dprint("thread {0} iter {1} start".format(thread_id, i))
5752
self.module.main()
58-
dprint("thread %s iter %d end" % (thread_id, i))
53+
dprint("thread {0} iter {1} end".format(thread_id, i))
5954
self.done.append(None)
60-
dprint("thread %s done" % thread_id)
55+
dprint("thread {0} done".format(thread_id))
6156

62-
def stressTest(self, iterations=1, threads=1):
57+
def stress_test(self, iterations=1, threads=1):
6358
args = (iterations,)
64-
self.markStart()
59+
self.mark_start()
6560
for _ in range(threads):
66-
thread = threading.Thread(target=self.runThread, args=args)
61+
thread = threading.Thread(target=self.run_thread, args=args)
6762
thread.start()
6863
while len(self.done) < (iterations * threads):
6964
dprint(len(self.done))
7065
time.sleep(0.1)
71-
self.markFinish()
66+
self.mark_finish()
7267
took = self.elapsed()
73-
self.printGCReport()
68+
self.print_gc_report()
7469

7570

7671
def main():
7772
test = StressTest()
78-
test.stressTest(2, 10)
73+
test.stress_test(2, 10)
7974

8075

8176
if __name__ == '__main__':

src/tests/stresstest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def main():
5050

5151
stop = time.clock()
5252
took = str(stop - start)
53-
print('Total Time: %s' % took)
53+
print('Total Time: {0}'.format(took))
5454

5555
for i in gc.get_objects():
5656
print(i)

0 commit comments

Comments
 (0)