File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 11import logging
22import os
3- from typing import Any , Optional
3+ from typing import Any
44
55from taskbadger .exceptions import (
66 ConfigurationError ,
@@ -110,7 +110,7 @@ def create_task(
110110 actions : list [Action ] = None ,
111111 monitor_id : str = None ,
112112 tags : dict [str , str ] = None ,
113- ) -> Optional [ "Task" ] :
113+ ) -> "Task" :
114114 """Create a Task.
115115
116116 Arguments:
@@ -152,7 +152,7 @@ def create_task(
152152
153153 task_dict = Badger .current .call_before_create (task_dict )
154154 if not task_dict :
155- return None
155+ raise TaskbadgerException ( "before_create callback returned None" )
156156
157157 task = TaskRequest .from_dict (task_dict )
158158 kwargs = _make_args (body = task )
@@ -273,7 +273,7 @@ def create(
273273 actions : list [Action ] = None ,
274274 monitor_id : str = None ,
275275 tags : dict [str , str ] = None ,
276- ) -> Optional [ "Task" ] :
276+ ) -> "Task" :
277277 """Create a new task
278278
279279 See [taskbadger.create_task][] for more information.
Original file line number Diff line number Diff line change @@ -125,8 +125,8 @@ def before_create(_):
125125
126126 settings .before_create = before_create
127127
128- task = create_task ( name = "task name" )
129- assert task is None
128+ with pytest . raises ( TaskbadgerException ):
129+ create_task ( name = "task name" )
130130
131131 patched_create .assert_not_called ()
132132
You can’t perform that action at this time.
0 commit comments