|
18 | 18 | GuideAlreadyHasChapter, |
19 | 19 | InvalidChapter, |
20 | 20 | InvalidChild, |
| 21 | + InvalidChildCount, |
21 | 22 | InvalidContextError, |
22 | 23 | InvalidIAEntry, |
23 | 24 | InvalidIALinkedData, |
@@ -4272,6 +4273,52 @@ def test_composable_tutorial_errors() -> None: |
4272 | 4273 | MissingChild, |
4273 | 4274 | ] |
4274 | 4275 |
|
| 4276 | + # below test has mismatch of options and default ids (defaults has more ids than options) |
| 4277 | + with make_test( |
| 4278 | + { |
| 4279 | + Path( |
| 4280 | + "source/index.txt" |
| 4281 | + ): """ |
| 4282 | +.. composable-tutorial:: |
| 4283 | + :options: interface, language, cluster-topology, cloud-provider |
| 4284 | + :defaults: driver, None, repl |
| 4285 | +
|
| 4286 | + .. selected-content:: |
| 4287 | + :selections: driver, None, repl |
| 4288 | + """ |
| 4289 | + } |
| 4290 | + ) as result: |
| 4291 | + diagnostics = result.diagnostics[FileId("index.txt")] |
| 4292 | + assert len(diagnostics) >= 1 |
| 4293 | + invalidChildError = next( |
| 4294 | + (d for d in diagnostics if isinstance(d, InvalidChildCount)), None |
| 4295 | + ) |
| 4296 | + assert invalidChildError |
| 4297 | + assert "defaults" in invalidChildError.message |
| 4298 | + |
| 4299 | + # below test has mismatch of options and default ids (defaults has less ids than options) |
| 4300 | + with make_test( |
| 4301 | + { |
| 4302 | + Path( |
| 4303 | + "source/index.txt" |
| 4304 | + ): """ |
| 4305 | +.. composable-tutorial:: |
| 4306 | + :options: interface, language, cluster-topology |
| 4307 | + :defaults: driver, None, repl, gcp |
| 4308 | +
|
| 4309 | + .. selected-content:: |
| 4310 | + :selections: driver, None, repl, gcp |
| 4311 | + """ |
| 4312 | + } |
| 4313 | + ) as result: |
| 4314 | + diagnostics = result.diagnostics[FileId("index.txt")] |
| 4315 | + assert len(diagnostics) >= 1 |
| 4316 | + invalidChildError = next( |
| 4317 | + (d for d in diagnostics if isinstance(d, InvalidChildCount)), None |
| 4318 | + ) |
| 4319 | + assert invalidChildError |
| 4320 | + assert "defaults" in invalidChildError.message |
| 4321 | + |
4275 | 4322 |
|
4276 | 4323 | def test_composable_headings() -> None: |
4277 | 4324 | with make_test( |
|
0 commit comments