11import json
22
3- import pytest
43from devtools import debug
5- from pydantic import validate_call
64
75from fractal_tasks_core .dev .lib_args_schemas import (
86 create_schema_for_single_task ,
@@ -21,60 +19,3 @@ def test_create_schema_for_single_task_usage_1():
2119 )
2220 debug (schema )
2321 print (json .dumps (schema , indent = 2 ))
24-
25-
26- @validate_call
27- def task_function (arg_1 : int = 1 ):
28- """
29- Description
30-
31- Args:
32- arg_1: Description of arg_1.
33- """
34-
35-
36- def test_create_schema_for_single_task_usage_2 ():
37- """
38- This test reproduces the schema-creation scenario starting from an
39- existing function, as it's done in tests.
40- """
41- schema = create_schema_for_single_task (
42- task_function = task_function ,
43- executable = __file__ ,
44- package = None ,
45- verbose = True ,
46- )
47- debug (schema )
48- print (json .dumps (schema , indent = 2 ))
49-
50-
51- def test_create_schema_for_single_task_failures ():
52- """
53- This test reproduces some invalid usage of the schema-creation function
54- """
55- with pytest .raises (ValueError ):
56- create_schema_for_single_task (
57- task_function = task_function ,
58- executable = __file__ ,
59- package = "something" ,
60- verbose = True ,
61- )
62- with pytest .raises (ValueError ):
63- create_schema_for_single_task (
64- task_function = task_function ,
65- executable = "non_absolute/path/module.py" ,
66- package = None ,
67- verbose = True ,
68- )
69- with pytest .raises (ValueError ):
70- create_schema_for_single_task (
71- executable = "/absolute/path/cellpose_segmentation.py" ,
72- package = "fractal_tasks_core" ,
73- verbose = True ,
74- )
75- with pytest .raises (ValueError ):
76- create_schema_for_single_task (
77- executable = "cellpose_segmentation.py" ,
78- package = None ,
79- verbose = True ,
80- )
0 commit comments