forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtask_test.py
24 lines (21 loc) · 870 Bytes
/
task_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import unittest
from caffe2.python import task
class TestTask(unittest.TestCase):
def testRepr(self):
cases = [
(task.Cluster(), "Cluster(nodes=[], node_kwargs={})"),
(task.Node(), "Node(name=local, kwargs={})"),
(
task.TaskGroup(),
"TaskGroup(tasks=[], workspace_type=None, remote_nets=[])",
),
(task.TaskOutput([]), "TaskOutput(names=[], values=None)"),
(task.Task(), "Task(name=local/task, node=local, outputs=[])"),
(task.SetupNets(), "SetupNets(init_nets=None, exit_nets=None)"),
]
for obj, want in cases:
self.assertEqual(obj.__repr__(), want)
def testEffectlessRepr(self):
task_group = task.TaskGroup()
_repr = task_group.__repr__()
self.assertFalse(task_group._already_used)