From ffcb4b87846b4e4a2d9eee8df4b7ec40365878b8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 5 Jun 2024 18:20:58 +0200 Subject: Merging upstream version 7.3.7. Signed-off-by: Daniel Baumann --- tests/test_markup/test_metadata.py | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/test_markup/test_metadata.py (limited to 'tests/test_markup/test_metadata.py') diff --git a/tests/test_markup/test_metadata.py b/tests/test_markup/test_metadata.py new file mode 100644 index 0000000..7f31997 --- /dev/null +++ b/tests/test_markup/test_metadata.py @@ -0,0 +1,43 @@ +"""Test our handling of metadata in files with bibliographic metadata.""" + +# adapted from an example of bibliographic metadata at +# https://docutils.sourceforge.io/docs/user/rst/demo.txt + +import pytest + + +@pytest.mark.sphinx('dummy', testroot='metadata') +def test_docinfo(app, status, warning): + """ + Inspect the 'docinfo' metadata stored in the first node of the document. + Note this doesn't give us access to data stored in subsequence blocks + that might be considered document metadata, such as 'abstract' or + 'dedication' blocks, or the 'meta' role. Doing otherwise is probably more + messing with the internals of sphinx than this rare use case merits. + """ + app.build() + expecteddocinfo = { + 'author': 'David Goodger', + 'authors': ['Me', 'Myself', 'I'], + 'address': '123 Example Street\nExample, EX Canada\nA1B 2C3', + 'field name': 'This is a generic bibliographic field.', + 'field name 2': ('Generic bibliographic fields may contain multiple ' + 'body elements.\n\nLike this.'), + 'status': 'This is a “work in progress”', + 'version': '1', + 'copyright': ('This document has been placed in the public domain. ' + 'You\nmay do with it as you wish. You may copy, modify,' + '\nredistribute, reattribute, sell, buy, rent, lease,\n' + 'destroy, or improve it, quote it at length, excerpt,\n' + 'incorporate, collate, fold, staple, or mutilate it, or ' + 'do\nanything else to it that your or anyone else’s ' + 'heart\ndesires.'), + 'contact': 'goodger@python.org', + 'date': '2006-05-21', + 'organization': 'humankind', + 'revision': '4564', + 'tocdepth': 1, + 'orphan': '', + 'nocomments': '', + } + assert app.env.metadata['index'] == expecteddocinfo -- cgit v1.2.3