99
1010
1111@pytest .mark .parametrize (
12- "fname,expect" ,
13- flat_dict (
14- {
15- 'index.html' : [
16- (".//div[@role='navigation']//a[@class='reference internal']" , 'Sample' ),
17- (".//div[@role='navigation']//a[@class='reference internal']" , 'Command A' ),
18- (".//div[@role='navigation']//a[@class='reference internal']" , 'Command B' ),
19- (".//div[@role='navigation']//a[@class='reference internal']" , 'Commands by Group' ),
20- ],
21- 'commands-by-group.html' : [
22- (".//h1" , 'Commands by Group' ),
23- (".//tr/td[2]/strong" , 'ham in a cone' ),
24- (".//tr[td[2]/strong/text()='ham in a cone']/following-sibling::tr[1]/td[2]/a/code" , 'sample-directive-opts' ),
25- (".//tr[td[2]/strong/text()='ham in a cone']/following-sibling::tr[2]/td[2]/a/code" , 'sample-directive-opts B' ),
26- (".//tr/td[2]/strong" , 'spam' ),
27- (".//tr[td[2]/strong/text()='spam on a stick']/following-sibling::tr[1]/td[2]/a/code" , 'sample-directive-opts' ),
28- (".//tr[td[2]/strong/text()='spam on a stick']/following-sibling::tr[2]/td[2]/a/code" , 'sample-directive-opts A' ),
29- (".//tr/td[2]/em" , '(other)' , False ), # Other does not have idxgroups set at all and is not present.
30- ],
31- }
32- ),
12+ ('fname' , 'expect' ),
13+ flat_dict ({
14+ 'index.html' : [
15+ (".//div[@role='navigation']//a[@class='reference internal']" , 'Sample' ),
16+ (".//div[@role='navigation']//a[@class='reference internal']" , 'Command A' ),
17+ (".//div[@role='navigation']//a[@class='reference internal']" , 'Command B' ),
18+ (
19+ ".//div[@role='navigation']//a[@class='reference internal']" ,
20+ 'Commands by Group' ,
21+ ),
22+ ],
23+ 'commands-by-group.html' : [
24+ ('.//h1' , 'Commands by Group' ),
25+ ('.//tr/td[2]/strong' , 'ham in a cone' ),
26+ (
27+ ".//tr[td[2]/strong/text()='ham in a cone']/following-sibling::tr[1]/td[2]/a/code" , # NoQA: E501
28+ 'sample-directive-opts' ,
29+ ),
30+ (
31+ ".//tr[td[2]/strong/text()='ham in a cone']/following-sibling::tr[2]/td[2]/a/code" , # NoQA: E501
32+ 'sample-directive-opts B' ,
33+ ),
34+ ('.//tr/td[2]/strong' , 'spam' ),
35+ (
36+ ".//tr[td[2]/strong/text()='spam on a stick']/following-sibling::tr[1]/td[2]/a/code" , # NoQA: E501
37+ 'sample-directive-opts' ,
38+ ),
39+ (
40+ ".//tr[td[2]/strong/text()='spam on a stick']/following-sibling::tr[2]/td[2]/a/code" , # NoQA: E501
41+ 'sample-directive-opts A' ,
42+ ),
43+ (
44+ './/tr/td[2]/em' ,
45+ '(other)' ,
46+ False ,
47+ ), # Other does not have idxgroups set at all and is not present.
48+ ],
49+ }),
3350)
3451@pytest .mark .sphinx ('html' , testroot = 'command-by-group-index' )
3552def test_commands_by_group_index_html (app , cached_etree_parse , fname , expect ):
@@ -38,27 +55,28 @@ def test_commands_by_group_index_html(app, cached_etree_parse, fname, expect):
3855
3956
4057@pytest .mark .parametrize (
41- "fname,expect" ,
42- flat_dict (
43- {
44- 'index.html' : [
45- (".//div[@role='navigation']//a[@class='reference internal']" , 'Commands grouped by SomeName' ),
46- ],
47- 'commands-groupedby-somename.html' : [
48- (".//h1" , 'Commands grouped by SomeName' ),
49- (".//h1" , 'Commands by Group' , False ),
50- ],
51- }
52- ),
58+ ('fname' , 'expect' ),
59+ flat_dict ({
60+ 'index.html' : [
61+ (
62+ ".//div[@role='navigation']//a[@class='reference internal']" ,
63+ 'Commands grouped by SomeName' ,
64+ ),
65+ ],
66+ 'commands-groupedby-somename.html' : [
67+ ('.//h1' , 'Commands grouped by SomeName' ),
68+ ('.//h1' , 'Commands by Group' , False ),
69+ ],
70+ }),
5371)
5472@pytest .mark .sphinx (
5573 'html' ,
5674 testroot = 'command-by-group-index' ,
5775 confoverrides = {
5876 'sphinx_argparse_conf' : {
59- " commands_by_group_index_title" : " Commands grouped by SomeName" ,
60- " commands_by_group_index_file_suffix" : " groupedby-somename" ,
61- " commands_by_group_index_in_toctree" : True ,
77+ ' commands_by_group_index_title' : ' Commands grouped by SomeName' ,
78+ ' commands_by_group_index_file_suffix' : ' groupedby-somename' ,
79+ ' commands_by_group_index_in_toctree' : True ,
6280 }
6381 },
6482)
@@ -78,5 +96,5 @@ def update_toctree(app):
7896
7997@pytest .mark .sphinx ('html' , testroot = 'command-by-group-index' )
8098def test_by_group_index_overrides_files_html (app ):
81- assert os .path .exists (app .outdir / (CommandsByGroupIndex .name + " .html" )) is False
82- assert os .path .exists (app .outdir / " commands-groupedby-somename.html" ) is True
99+ assert os .path .exists (app .outdir / (CommandsByGroupIndex .name + ' .html' )) is False
100+ assert os .path .exists (app .outdir / ' commands-groupedby-somename.html' ) is True
0 commit comments