summaryrefslogtreecommitdiff
path: root/test.py
diff options
context:
space:
mode:
authorMichele Simionato <michele.simionato@gmail.com>2015-07-19 19:13:36 +0200
committerMichele Simionato <michele.simionato@gmail.com>2015-07-19 19:13:36 +0200
commita4e7a82790a134ca44746de88bdc0354e90c442c (patch)
tree471fc9c4775b2a3660148e4a0c77acb58bbee788 /test.py
parentcf20ab367249c9eca473d6f9989f0721e451b033 (diff)
downloadpython-decorator-git-a4e7a82790a134ca44746de88bdc0354e90c442c.tar.gz
Simplified the concurrency example by using a Future class
Diffstat (limited to 'test.py')
-rw-r--r--test.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/test.py b/test.py
index cf6dd3d..101f8dc 100644
--- a/test.py
+++ b/test.py
@@ -4,6 +4,7 @@ Some simple tests
import os
import sys
+import time
import doctest
from decorator import decorator
import documentation
@@ -34,9 +35,18 @@ def test1():
this = getfname(f1)
assert this == 'test.py', this
+
+def test_long_running():
+ f1 = documentation.long_running(1)
+ f2 = documentation.long_running(2)
+ assert f1.result() + f2.result() == 3
+
if __name__ == '__main__':
+ t0 = time.time()
for name, test in list(globals().items()):
if name.startswith('test'):
test()
err = doctest.testmod(documentation)[0]
+ t1 = time.time()
+ print('Tests run in %s seconds' % (t1 - t0))
sys.exit(err)