tests speedup

This commit is contained in:
Paul Müller 2015-02-13 09:12:56 +01:00
parent 2356a6a05e
commit a2e5718040
2 changed files with 7 additions and 8 deletions

View file

@ -7,7 +7,6 @@ from __future__ import division, print_function
from inspect import getcallargs from inspect import getcallargs
from . import progress from . import progress
from .jobmanager import getCountKwargs, validCountKwargs from .jobmanager import getCountKwargs, validCountKwargs
__all__ = ["ProgressBar", "ProgressBarOverrideCount"] __all__ = ["ProgressBar", "ProgressBarOverrideCount"]

View file

@ -20,7 +20,7 @@ def _my_func_1(arg,
count = decorators.progress.UnsignedIntValue(val=0), count = decorators.progress.UnsignedIntValue(val=0),
max_count = decorators.progress.UnsignedIntValue(val=1), max_count = decorators.progress.UnsignedIntValue(val=1),
sleep = 0.01): sleep = 0.01):
maxval = 100 maxval = 50
max_count.value = maxval max_count.value = maxval
for i in range(maxval): for i in range(maxval):
@ -34,7 +34,7 @@ def _my_func_2(arg,
c = decorators.progress.UnsignedIntValue(val=0), c = decorators.progress.UnsignedIntValue(val=0),
m = decorators.progress.UnsignedIntValue(val=1), m = decorators.progress.UnsignedIntValue(val=1),
kwarg = "2"): kwarg = "2"):
maxval = 100 maxval = 50
m.value += maxval m.value += maxval
for i in range(maxval): for i in range(maxval):
@ -154,7 +154,7 @@ def test_ProgressBar():
result1 = _my_func_1("decorated function", kwarg=" 1") result1 = _my_func_1("decorated function", kwarg=" 1")
print(result1) print(result1)
wrapper = decorators.ProgressBar(_my_func_2, interval=.01) wrapper = decorators.ProgressBar(_my_func_2, interval=.1)
result2 = wrapper("wrapped function", kwarg=" 2") result2 = wrapper("wrapped function", kwarg=" 2")
print(result2) print(result2)
@ -173,10 +173,10 @@ def test_ProgressBarOverrideCount():
if __name__ == "__main__": if __name__ == "__main__":
# test_ProgressBar() test_ProgressBar()
# test_decorator() test_decorator()
# test_ProgressBarOverrideCount() test_ProgressBarOverrideCount()
# test_extended_PB_get_access_to_progress_bar() test_extended_PB_get_access_to_progress_bar()
test_extended_PB_progress_bar_off() test_extended_PB_progress_bar_off()