Skip to content

Commit 38559cb

Browse files
committed
👌 Refactor inventory to use wildcards
1 parent 66881ef commit 38559cb

10 files changed

+241
-125
lines changed

myst_parser/inventory.py

Lines changed: 210 additions & 102 deletions
Large diffs are not rendered by default.

tests/test_inventory.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,15 @@ def test_convert_roundtrip():
2222

2323
def test_inv_filter(data_regression):
2424
with (STATIC / "objects_v2.inv").open("rb") as f:
25-
inv = to_sphinx(load(f))
26-
output = [m.asdict() for m in filter_inventories({"inv": inv}, "index")]
25+
inv = load(f)
26+
output = [m.asdict() for m in filter_inventories({"inv": inv}, targets="index")]
2727
data_regression.check(output)
2828

2929

30-
def test_inv_filter_fnmatch(data_regression):
30+
def test_inv_filter_wildcard(data_regression):
3131
with (STATIC / "objects_v2.inv").open("rb") as f:
32-
inv = to_sphinx(load(f))
33-
output = [
34-
m.asdict()
35-
for m in filter_inventories({"inv": inv}, "*index", fnmatch_target=True)
36-
]
32+
inv = load(f)
33+
output = [m.asdict() for m in filter_inventories({"inv": inv}, targets="*index")]
3734
data_regression.check(output)
3835

3936

tests/test_inventory/test_inv_cli_v1.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: foo
22
version: '1.0'
3+
base_url: null
34
objects:
45
py:
56
module:

tests/test_inventory/test_inv_cli_v2_options0_.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Python
22
version: ''
3+
base_url: null
34
objects:
45
std:
56
label:

tests/test_inventory/test_inv_cli_v2_options1_.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Python
22
version: ''
3+
base_url: null
34
objects:
45
std:
56
label:

tests/test_inventory/test_inv_cli_v2_options2_.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Python
22
version: ''
3+
base_url: null
34
objects:
45
std:
56
doc:

tests/test_inventory/test_inv_cli_v2_options3_.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Python
22
version: ''
3+
base_url: null
34
objects:
45
std:
56
label:

tests/test_inventory/test_inv_cli_v2_options4_.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Python
22
version: ''
3+
base_url: null
34
objects:
45
std:
56
label:
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
- domain: std
1+
- base_url: null
2+
domain: std
23
inv: inv
4+
loc: index.html
35
name: index
46
otype: doc
5-
proj: Python
7+
project: Python
68
text: Title
7-
uri: index.html
89
version: ''
Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,36 @@
1-
- domain: std
1+
- base_url: null
2+
domain: std
23
inv: inv
4+
loc: genindex.html
35
name: genindex
46
otype: label
5-
proj: Python
7+
project: Python
68
text: Index
7-
uri: genindex.html
89
version: ''
9-
- domain: std
10+
- base_url: null
11+
domain: std
1012
inv: inv
13+
loc: py-modindex.html
1114
name: modindex
1215
otype: label
13-
proj: Python
16+
project: Python
1417
text: Module Index
15-
uri: py-modindex.html
1618
version: ''
17-
- domain: std
19+
- base_url: null
20+
domain: std
1821
inv: inv
22+
loc: py-modindex.html
1923
name: py-modindex
2024
otype: label
21-
proj: Python
25+
project: Python
2226
text: Python Module Index
23-
uri: py-modindex.html
2427
version: ''
25-
- domain: std
28+
- base_url: null
29+
domain: std
2630
inv: inv
31+
loc: index.html
2732
name: index
2833
otype: doc
29-
proj: Python
34+
project: Python
3035
text: Title
31-
uri: index.html
3236
version: ''

0 commit comments

Comments
 (0)