コード例 #1
0
 def sibling_subcollections_ignored(self):
     inner = Collection("inner", self.task)
     inner.configure({"foo": "hi there"})
     inner2 = Collection("inner2", Task(_func, name="task2"))
     inner2.configure({"foo": "nope"})
     root = Collection(inner, inner2)
     assert root.configuration("inner.task")["foo"] == "hi there"
     assert root.configuration("inner2.task2")["foo"] == "nope"
コード例 #2
0
        def raises_ValueError_if_no_name_found(self):
            # Can't use a lambda here as they are technically real functions.
            class Callable(object):
                def __call__(self):
                    pass

            with raises(ValueError):
                self.c.add_task(Task(Callable()))
コード例 #3
0
 def setup(self):
     self.root = Collection()
     self.task = Task(_func, name="task")
コード例 #4
0
 def honors_own_default_task_with_no_args(self):
     t = Task(_func, default=True)
     self.c.add_task(t)
     assert self.c[""] == t
コード例 #5
0
 def honors_aliases_in_own_tasks(self):
     t = Task(_func, aliases=["bar"])
     self.c.add_task(t, "foo")
     assert self.c["bar"] == t
コード例 #6
0
 def raises_ValueError_on_multiple_defaults(self):
     t1 = Task(_func, default=True)
     t2 = Task(_func, default=True)
     self.c.add_task(t1, "foo")
     with raises(ValueError):
         self.c.add_task(t2, "bar")
コード例 #7
0
 def prefers_task_name_attr_over_function_name(self):
     self.c.add_task(Task(_func, name="notfunc"))
     assert "notfunc" in self.c
     assert "_func" not in self.c
コード例 #8
0
 def prefers_name_kwarg_over_task_name_attr(self):
     self.c.add_task(Task(_func, name="notfunc"), name="yesfunc")
     assert "yesfunc" in self.c
     assert "notfunc" not in self.c