@@ -25,47 +25,49 @@ class SchemaManager:
25
25
26
26
def __init__ (self : SchemaManager , file_name : Path ):
27
27
"""Create a schema for my tests."""
28
- # TODO(igor): simplify by moving parts out of here into separate variables.
28
+
29
+ injection_schema = {
30
+ Tags .INJECT_SOURCE_TAG : str ,
31
+ Tags .INJECT_DESTINATION_TAG : str ,
32
+ }
33
+
34
+ test_schema = {
35
+ Tags .NAME_TAG : str ,
36
+ Optional (Tags .INPUT_TAG ): str ,
37
+ Optional (Tags .INJECT_FOLDER_TAG ): [injection_schema ],
38
+ Optional (Tags .RUN_GTESTS_TAG , default = False ): bool ,
39
+ Optional (Tags .EXPECTED_OUTPUT_TAG ): Or (str , float , int ),
40
+ Optional (Tags .TIMEOUT_TAG , default = 60 ): float ,
41
+ }
42
+
43
+ task_schema = {
44
+ Tags .NAME_TAG : str ,
45
+ Tags .LANGUAGE_TAG : Or (LangTags .CPP , LangTags .BASH ),
46
+ Tags .FOLDER_TAG : str ,
47
+ Optional (Tags .OUTPUT_TYPE_TAG , default = OutputTags .STRING ): Or (
48
+ OutputTags .STRING , OutputTags .NUMBER
49
+ ),
50
+ Optional (Tags .COMPILER_FLAGS_TAG , default = "-Wall" ): str ,
51
+ Optional (Tags .BINARY_NAME_TAG , default = "main" ): str ,
52
+ Optional (Tags .PIPE_TAG , default = "" ): str ,
53
+ Optional (Tags .BUILD_TYPE_TAG , default = BuildTags .CMAKE ): Or (
54
+ BuildTags .CMAKE , BuildTags .SIMPLE
55
+ ),
56
+ Optional (Tags .BUILD_TIMEOUT_TAG , default = 60 ): float ,
57
+ Optional (Tags .TESTS_TAG ): [test_schema ],
58
+ }
59
+
60
+ homework_schema = {
61
+ Tags .NAME_TAG : str ,
62
+ Tags .FOLDER_TAG : str ,
63
+ Optional (Tags .DEADLINE_TAG , default = MAX_DATE_STR ): str ,
64
+ Tags .TASKS_TAG : [task_schema ],
65
+ }
66
+
29
67
self .__schema = Schema (
30
68
{
31
69
Tags .FOLDER_TAG : str ,
32
- Tags .HOMEWORKS_TAG : [
33
- {
34
- Tags .NAME_TAG : str ,
35
- Tags .FOLDER_TAG : str ,
36
- Optional (Tags .DEADLINE_TAG , default = MAX_DATE_STR ): str ,
37
- Tags .TASKS_TAG : [
38
- {
39
- Tags .NAME_TAG : str ,
40
- Tags .LANGUAGE_TAG : Or (LangTags .CPP , LangTags .BASH ),
41
- Tags .FOLDER_TAG : str ,
42
- Optional (
43
- Tags .OUTPUT_TYPE_TAG , default = OutputTags .STRING
44
- ): Or (OutputTags .STRING , OutputTags .NUMBER ),
45
- Optional (Tags .COMPILER_FLAGS_TAG , default = "-Wall" ): str ,
46
- Optional (Tags .BINARY_NAME_TAG , default = "main" ): str ,
47
- Optional (Tags .PIPE_TAG , default = "" ): str ,
48
- Optional (
49
- Tags .BUILD_TYPE_TAG , default = BuildTags .CMAKE
50
- ): Or (BuildTags .CMAKE , BuildTags .SIMPLE ),
51
- Optional (Tags .INJECT_FOLDER_TAG ): [str ],
52
- Optional (Tags .TESTS_TAG ): [
53
- {
54
- Tags .NAME_TAG : str ,
55
- Optional (Tags .INPUT_TAG ): str ,
56
- Optional (Tags .INJECT_FOLDER_TAG ): [str ],
57
- Optional (
58
- Tags .RUN_GTESTS_TAG , default = False
59
- ): bool ,
60
- Optional (Tags .EXPECTED_OUTPUT_TAG ): Or (
61
- str , float , int
62
- ),
63
- }
64
- ],
65
- }
66
- ],
67
- }
68
- ],
70
+ Tags .HOMEWORKS_TAG : [homework_schema ],
69
71
}
70
72
)
71
73
yaml = YAML ()
0 commit comments