File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6262graphviz_output_format = "svg"
6363
6464templates_path = ["_templates" ]
65- exclude_patterns = ["_build" , "Thumbs.db" , ".DS_Store" ]
65+ exclude_patterns = [
66+ "_build" ,
67+ "Thumbs.db" ,
68+ ".DS_Store" ,
69+ # Tables that question-format.md includes: pages of their own otherwise.
70+ "_autosummary/question-format/*.md" ,
71+ ]
6672source_suffix = [".rst" , ".md" ]
6773
6874copybutton_prompt_text = "$ "
Original file line number Diff line number Diff line change @@ -133,10 +133,12 @@ def _flatten(
133133 A key holding an object is descended into, so that `workedSolution` becomes
134134 `workedSolution.content`, unless it has a note of its own — `gradeParams` and
135135 `config` hold whatever the box type needs, and are described in prose instead.
136+ An empty object is a row like any other: descending into it would yield nothing,
137+ so a new key holding `{}` would go unnoticed rather than asking for a note.
136138 """
137139 for key , value in obj .items ():
138140 full_path = f"{ path } { key } "
139- if isinstance (value , dict ) and full_path not in notes :
141+ if isinstance (value , dict ) and value and full_path not in notes :
140142 yield from _flatten (value , notes , f"{ full_path } ." )
141143 else :
142144 yield full_path , value
Original file line number Diff line number Diff line change @@ -49,12 +49,15 @@ def test_tables_cover_the_exported_keys(tmp_path: Path) -> None:
4949 assert "response.responseInput.config" in _table_keys (tmp_path / "response_area.md" )
5050
5151
52- def test_a_key_with_no_note_is_named (tmp_path : Path ) -> None :
52+ # An empty object holds no keys to descend into, so it has to be a row in its own
53+ # right for a new key to be named rather than silently dropped.
54+ @pytest .mark .parametrize ("value" , [1 , {}])
55+ def test_a_key_with_no_note_is_named (value : object , tmp_path : Path ) -> None :
5356 """A key added to the schema stops the build, saying which key needs a note."""
5457 export_dir = Path (shutil .copytree (EXPORTS [0 ], tmp_path / "export" ))
5558 file = sorted (export_dir .glob ("question_*.json" ))[0 ]
5659 question = json .loads (file .read_text ())
57- question ["madeUp" ] = 1
60+ question ["madeUp" ] = value
5861 file .write_text (json .dumps (question ))
5962
6063 with pytest .raises (ValueError , match = "madeUp" ):
You can’t perform that action at this time.
0 commit comments