Skip to content

Commit

Permalink
collection tests
Browse files Browse the repository at this point in the history
  • Loading branch information
divi255 committed Jul 20, 2019
1 parent d9885f7 commit 3da4337
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from types import SimpleNamespace

result = SimpleNamespace(
function_collection=0,
task_collection=0,
background_task_annotated=None,
background_task_thread=None,
background_task_mp=None,
Expand All @@ -28,9 +30,41 @@ def wait():

from atasker import task_supervisor, background_task, background_worker, TT_MP

from atasker import FunctionCollection, TaskCollection


class Test(unittest.TestCase):

def test_function_collection(self):

f = FunctionCollection()

@f
def f1():
result.function_collection += 1

@f
def f2():
result.function_collection += 2

f.run()
self.assertEqual(result.function_collection, 3)

def test_task_collection(self):

f = TaskCollection()

@f
def f1():
result.task_collection += 1

@f
def f2():
result.task_collection += 2

f.run()
self.assertEqual(result.task_collection, 3)

def test_background_task_annotated(self):

@background_task
Expand Down

0 comments on commit 3da4337

Please sign in to comment.