@@ -44,8 +44,50 @@ def test_basics(make_app, rootdir):
44
44
assert section [3 ].astext () == 'Commands'
45
45
assert isinstance (section [4 ], sphinx_nodes .index )
46
46
assert isinstance (section [5 ], sphinx_nodes .desc )
47
+ assert section [5 ].astext () == 'hello\n \n Greet a user.'
47
48
assert isinstance (section [6 ], sphinx_nodes .index )
48
49
assert isinstance (section [7 ], sphinx_nodes .desc )
50
+ assert section [7 ].astext () == 'world\n \n Greet the world.'
51
+
52
+
53
+ def test_commands (make_app , rootdir ):
54
+ srcdir = rootdir / 'commands'
55
+ app = make_app ('xml' , srcdir = srcdir )
56
+ app .build ()
57
+
58
+ # TODO: rather than using the pickled doctree, we should decode the XML
59
+ content = pickle .loads ((app .doctreedir / 'index.doctree' ).read_bytes ())
60
+
61
+ # doc has format like so:
62
+ #
63
+ # document:
64
+ # section:
65
+ # title:
66
+ # section:
67
+ # title:
68
+ # paragraph:
69
+ # literal_block:
70
+ # rubric:
71
+ # index:
72
+ # desc:
73
+ # desc_signature:
74
+ # desc_signature:
75
+
76
+ section = content [0 ][1 ]
77
+ assert isinstance (section , nodes .section )
78
+
79
+ assert isinstance (section [0 ], nodes .title )
80
+ assert section [0 ].astext () == 'greet'
81
+ assert isinstance (section [1 ], nodes .paragraph )
82
+ assert section [1 ].astext () == 'A sample command group.'
83
+ assert isinstance (section [2 ], nodes .literal_block )
84
+
85
+ # we should only show a single command, 'world'
86
+ assert isinstance (section [3 ], nodes .rubric )
87
+ assert section [3 ].astext () == 'Commands'
88
+ assert isinstance (section [4 ], sphinx_nodes .index )
89
+ assert isinstance (section [5 ], sphinx_nodes .desc )
90
+ assert section [5 ].astext () == 'world\n \n Greet the world.'
49
91
50
92
51
93
def test_nested_full (make_app , rootdir ):
0 commit comments