Skip to content

Commit 34d287e

Browse files
committed
add docstrings to tests
1 parent c4ebbbc commit 34d287e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

quartodoc/tests/test_validation.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,34 +26,40 @@ def sections():
2626
return copy.deepcopy(EXAMPLE_SECTIONS)
2727

2828
def test_valid_yaml(sections):
29+
"Test that valid YAML passes validation"
2930
Builder(sections=sections, package='quartodoc')
3031

3132
def test_missing_title(sections):
33+
"Test that missing title raises an error"
3234
del sections[0]['title']
3335
with pytest.raises(ValueError) as e:
3436
Builder(sections=sections, package='quartodoc')
3537
assert '- Missing field `title` for element 0 in the list for `sections`' in str(e.value)
3638

3739
def test_missing_desc(sections):
40+
"Test that a missing description raises an error"
3841
sections = copy.deepcopy(EXAMPLE_SECTIONS)
3942
del sections[2]['desc']
4043
with pytest.raises(ValueError) as e:
4144
Builder(sections=sections, package='quartodoc')
4245
assert '- Missing field `desc` for element 2 in the list for `sections`' in str(e.value)
4346

4447
def test_missing_name_contents_1(sections):
48+
"Test that a missing name in contents raises an error"
4549
del sections[2]['contents'][0]['name']
4650
with pytest.raises(ValueError) as e:
4751
Builder(sections=sections, package='quartodoc')
4852
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)
4953

5054
def test_missing_name_contents_2(sections):
55+
"Test that a missing name in contents raises an error in a different section."
5156
del sections[1]['contents'][0]['name']
5257
with pytest.raises(ValueError) as e:
5358
Builder(sections=sections, package='quartodoc')
5459
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)
5560

5661
def test_misplaced_kindpage(sections):
62+
"Test that a misplaced kind: page raises an error"
5763
sections[0]['kind'] = 'page'
5864
with pytest.raises(ValueError) as e:
5965
Builder(sections=sections, package='quartodoc')

0 commit comments

Comments
 (0)