44import pytest
55
66from sphinxarg .ext import CommandsByGroupIndex
7-
8- from .conftest import check_xpath , flat_dict
7+ from test .utils .xpath import check_xpath
98
109
1110@pytest .mark .parametrize (
1211 ('fname' , 'expect' ),
13- flat_dict ({
14- 'index.html' : [
12+ [
13+ (
14+ 'index.html' ,
1515 (".//div[@role='navigation']//a[@class='reference internal']" , 'Sample' ),
16+ ),
17+ (
18+ 'index.html' ,
1619 (".//div[@role='navigation']//a[@class='reference internal']" , 'Command A' ),
20+ ),
21+ (
22+ 'index.html' ,
1723 (".//div[@role='navigation']//a[@class='reference internal']" , 'Command B' ),
24+ ),
25+ (
26+ 'index.html' ,
1827 (
1928 ".//div[@role='navigation']//a[@class='reference internal']" ,
2029 'Commands by Group' ,
2130 ),
22- ],
23- 'commands-by-group.html' : [
24- ('.//h1' , 'Commands by Group' ),
25- ('.//tr/td[2]/strong' , 'ham in a cone' ),
31+ ),
32+ ('commands-by-group.html' , ('.//h1' , 'Commands by Group' )),
33+ ('commands-by-group.html' , ('.//tr/td[2]/strong' , 'ham in a cone' )),
34+ (
35+ 'commands-by-group.html' ,
2636 (
2737 ".//tr[td[2]/strong/text()='ham in a cone']/following-sibling::tr[1]/td[2]/a/code" , # NoQA: E501
2838 'sample-directive-opts' ,
2939 ),
40+ ),
41+ (
42+ 'commands-by-group.html' ,
3043 (
3144 ".//tr[td[2]/strong/text()='ham in a cone']/following-sibling::tr[2]/td[2]/a/code" , # NoQA: E501
3245 'sample-directive-opts B' ,
3346 ),
34- ('.//tr/td[2]/strong' , 'spam' ),
47+ ),
48+ ('commands-by-group.html' , ('.//tr/td[2]/strong' , 'spam' )),
49+ (
50+ 'commands-by-group.html' ,
3551 (
3652 ".//tr[td[2]/strong/text()='spam on a stick']/following-sibling::tr[1]/td[2]/a/code" , # NoQA: E501
3753 'sample-directive-opts' ,
3854 ),
55+ ),
56+ (
57+ 'commands-by-group.html' ,
3958 (
4059 ".//tr[td[2]/strong/text()='spam on a stick']/following-sibling::tr[2]/td[2]/a/code" , # NoQA: E501
4160 'sample-directive-opts A' ,
4261 ),
62+ ),
63+ (
64+ 'commands-by-group.html' ,
4365 (
4466 './/tr/td[2]/em' ,
4567 '(other)' ,
4668 False ,
47- ), # Other does not have idxgroups set at all and is not present.
48- ],
49- }) ,
69+ ),
70+ ), # Other does not have idxgroups set at all and is not present.
71+ ] ,
5072)
5173@pytest .mark .sphinx ('html' , testroot = 'command-by-group-index' )
5274def test_commands_by_group_index_html (app , cached_etree_parse , fname , expect ):
@@ -56,18 +78,17 @@ def test_commands_by_group_index_html(app, cached_etree_parse, fname, expect):
5678
5779@pytest .mark .parametrize (
5880 ('fname' , 'expect' ),
59- flat_dict ({
60- 'index.html' : [
81+ [
82+ (
83+ 'index.html' ,
6184 (
6285 ".//div[@role='navigation']//a[@class='reference internal']" ,
6386 'Commands grouped by SomeName' ,
6487 ),
65- ],
66- 'commands-groupedby-somename.html' : [
67- ('.//h1' , 'Commands grouped by SomeName' ),
68- ('.//h1' , 'Commands by Group' , False ),
69- ],
70- }),
88+ ),
89+ ('commands-groupedby-somename.html' , ('.//h1' , 'Commands grouped by SomeName' )),
90+ ('commands-groupedby-somename.html' , ('.//h1' , 'Commands by Group' , False )),
91+ ],
7192)
7293@pytest .mark .sphinx (
7394 'html' ,
0 commit comments