Skip to content

Commit

Permalink
👌 Refactor inventory to use wildcards
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed Jan 10, 2023
1 parent 66881ef commit 38559cb
Show file tree
Hide file tree
Showing 10 changed files with 241 additions and 125 deletions.
312 changes: 210 additions & 102 deletions myst_parser/inventory.py

Large diffs are not rendered by default.

13 changes: 5 additions & 8 deletions tests/test_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,15 @@ def test_convert_roundtrip():

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


def test_inv_filter_fnmatch(data_regression):
def test_inv_filter_wildcard(data_regression):
with (STATIC / "objects_v2.inv").open("rb") as f:
inv = to_sphinx(load(f))
output = [
m.asdict()
for m in filter_inventories({"inv": inv}, "*index", fnmatch_target=True)
]
inv = load(f)
output = [m.asdict() for m in filter_inventories({"inv": inv}, targets="*index")]
data_regression.check(output)


Expand Down
1 change: 1 addition & 0 deletions tests/test_inventory/test_inv_cli_v1.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: foo
version: '1.0'
base_url: null
objects:
py:
module:
Expand Down
1 change: 1 addition & 0 deletions tests/test_inventory/test_inv_cli_v2_options0_.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Python
version: ''
base_url: null
objects:
std:
label:
Expand Down
1 change: 1 addition & 0 deletions tests/test_inventory/test_inv_cli_v2_options1_.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Python
version: ''
base_url: null
objects:
std:
label:
Expand Down
1 change: 1 addition & 0 deletions tests/test_inventory/test_inv_cli_v2_options2_.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Python
version: ''
base_url: null
objects:
std:
doc:
Expand Down
1 change: 1 addition & 0 deletions tests/test_inventory/test_inv_cli_v2_options3_.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Python
version: ''
base_url: null
objects:
std:
label:
Expand Down
1 change: 1 addition & 0 deletions tests/test_inventory/test_inv_cli_v2_options4_.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Python
version: ''
base_url: null
objects:
std:
label:
Expand Down
7 changes: 4 additions & 3 deletions tests/test_inventory/test_inv_filter.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
- domain: std
- base_url: null
domain: std
inv: inv
loc: index.html
name: index
otype: doc
proj: Python
project: Python
text: Title
uri: index.html
version: ''
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
- domain: std
- base_url: null
domain: std
inv: inv
loc: genindex.html
name: genindex
otype: label
proj: Python
project: Python
text: Index
uri: genindex.html
version: ''
- domain: std
- base_url: null
domain: std
inv: inv
loc: py-modindex.html
name: modindex
otype: label
proj: Python
project: Python
text: Module Index
uri: py-modindex.html
version: ''
- domain: std
- base_url: null
domain: std
inv: inv
loc: py-modindex.html
name: py-modindex
otype: label
proj: Python
project: Python
text: Python Module Index
uri: py-modindex.html
version: ''
- domain: std
- base_url: null
domain: std
inv: inv
loc: index.html
name: index
otype: doc
proj: Python
project: Python
text: Title
uri: index.html
version: ''

0 comments on commit 38559cb

Please sign in to comment.