File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -378,6 +378,56 @@ def test_am_replacer_skip_stdlib(tmpdir):
378
378
assert result == am_replacer_skip_stdlib_expected
379
379
380
380
381
+ am_replacer_include_stdlib_str = """
382
+ This comes before
383
+
384
+ .. automodapi:: sphinx_automodapi.tests.example_module.stdlib
385
+ :include: add
386
+ :allowed-package-names: pathlib, datetime, sphinx_automodapi
387
+
388
+ This comes after
389
+ """
390
+
391
+ am_replacer_include_stdlib_expected = """
392
+ This comes before
393
+
394
+
395
+ sphinx_automodapi.tests.example_module.stdlib Module
396
+ ----------------------------------------------------
397
+
398
+ .. automodule:: sphinx_automodapi.tests.example_module.stdlib
399
+
400
+ Functions
401
+ ^^^^^^^^^
402
+
403
+ .. automodsumm:: sphinx_automodapi.tests.example_module.stdlib
404
+ :functions-only:
405
+ :toctree: api
406
+ :skip: Path,time
407
+ :allowed-package-names: pathlib,datetime,sphinx_automodapi
408
+
409
+
410
+ This comes after
411
+ """ .format (empty = '' )
412
+
413
+
414
+ def test_am_replacer_include_stdlib (tmpdir ):
415
+ """
416
+ Tests using the ":include: option in an ".. automodapi::"
417
+ in the presence of objects imported from the standard library.
418
+ """
419
+
420
+ with open (tmpdir .join ('index.rst' ).strpath , 'w' ) as f :
421
+ f .write (am_replacer_include_stdlib_str .format (options = '' ))
422
+
423
+ run_sphinx_in_tmpdir (tmpdir )
424
+
425
+ with open (tmpdir .join ('index.rst.automodapi' ).strpath ) as f :
426
+ result = f .read ()
427
+
428
+ assert result == am_replacer_include_stdlib_expected
429
+
430
+
381
431
am_replacer_include_str = """
382
432
This comes before
383
433
You can’t perform that action at this time.
0 commit comments