@@ -26,34 +26,40 @@ def sections():
26
26
return copy .deepcopy (EXAMPLE_SECTIONS )
27
27
28
28
def test_valid_yaml (sections ):
29
+ "Test that valid YAML passes validation"
29
30
Builder (sections = sections , package = 'quartodoc' )
30
31
31
32
def test_missing_title (sections ):
33
+ "Test that missing title raises an error"
32
34
del sections [0 ]['title' ]
33
35
with pytest .raises (ValueError ) as e :
34
36
Builder (sections = sections , package = 'quartodoc' )
35
37
assert '- Missing field `title` for element 0 in the list for `sections`' in str (e .value )
36
38
37
39
def test_missing_desc (sections ):
40
+ "Test that a missing description raises an error"
38
41
sections = copy .deepcopy (EXAMPLE_SECTIONS )
39
42
del sections [2 ]['desc' ]
40
43
with pytest .raises (ValueError ) as e :
41
44
Builder (sections = sections , package = 'quartodoc' )
42
45
assert '- Missing field `desc` for element 2 in the list for `sections`' in str (e .value )
43
46
44
47
def test_missing_name_contents_1 (sections ):
48
+ "Test that a missing name in contents raises an error"
45
49
del sections [2 ]['contents' ][0 ]['name' ]
46
50
with pytest .raises (ValueError ) as e :
47
51
Builder (sections = sections , package = 'quartodoc' )
48
52
assert '- Missing field `name` for element 0 in the list for `contents` located in element 2 in the list for `sections`' in str (e .value )
49
53
50
54
def test_missing_name_contents_2 (sections ):
55
+ "Test that a missing name in contents raises an error in a different section."
51
56
del sections [1 ]['contents' ][0 ]['name' ]
52
57
with pytest .raises (ValueError ) as e :
53
58
Builder (sections = sections , package = 'quartodoc' )
54
59
assert '- Missing field `name` for element 0 in the list for `contents` located in element 1 in the list for `sections`' in str (e .value )
55
60
56
61
def test_misplaced_kindpage (sections ):
62
+ "Test that a misplaced kind: page raises an error"
57
63
sections [0 ]['kind' ] = 'page'
58
64
with pytest .raises (ValueError ) as e :
59
65
Builder (sections = sections , package = 'quartodoc' )
0 commit comments