10
10
import pytest
11
11
from mkdocstrings .inventory import Inventory
12
12
13
- import mkdocstrings_handlers
13
+ from mkdocstrings_handlers import python
14
14
15
15
if TYPE_CHECKING :
16
16
from collections .abc import Iterator
19
19
@pytest .fixture (name = "loader" , scope = "module" )
20
20
def _fixture_loader () -> griffe .GriffeLoader :
21
21
loader = griffe .GriffeLoader ()
22
- loader .load ("mkdocstrings_handlers" )
22
+ loader .load ("mkdocstrings_handlers.python " )
23
23
loader .resolve_aliases ()
24
24
return loader
25
25
26
26
27
27
@pytest .fixture (name = "internal_api" , scope = "module" )
28
28
def _fixture_internal_api (loader : griffe .GriffeLoader ) -> griffe .Module :
29
- return loader .modules_collection ["mkdocstrings_handlers._internal" ]
29
+ return loader .modules_collection ["mkdocstrings_handlers.python. _internal" ]
30
30
31
31
32
32
@pytest .fixture (name = "public_api" , scope = "module" )
33
33
def _fixture_public_api (loader : griffe .GriffeLoader ) -> griffe .Module :
34
- return loader .modules_collection ["mkdocstrings_handlers" ]
34
+ return loader .modules_collection ["mkdocstrings_handlers.python " ]
35
35
36
36
37
37
def _yield_public_objects (
@@ -50,7 +50,7 @@ def _yield_public_objects(
50
50
if modules :
51
51
yield member
52
52
yield from _yield_public_objects (
53
- member , # type: ignore[arg-type]
53
+ member ,
54
54
modules = modules ,
55
55
modulelevel = modulelevel ,
56
56
inherited = inherited ,
@@ -62,7 +62,7 @@ def _yield_public_objects(
62
62
continue
63
63
if member .is_class and not modulelevel :
64
64
yield from _yield_public_objects (
65
- member , # type: ignore[arg-type]
65
+ member ,
66
66
modules = modules ,
67
67
modulelevel = False ,
68
68
inherited = inherited ,
@@ -97,11 +97,11 @@ def _fixture_inventory() -> Inventory:
97
97
98
98
99
99
def test_exposed_objects (modulelevel_internal_objects : list [griffe .Object | griffe .Alias ]) -> None :
100
- """All public objects in the internal API are exposed under `mkdocstrings_handlers`."""
100
+ """All public objects in the internal API are exposed under `mkdocstrings_handlers.python `."""
101
101
not_exposed = [
102
102
obj .path
103
103
for obj in modulelevel_internal_objects
104
- if obj .name not in mkdocstrings_handlers .__all__ or not hasattr (mkdocstrings_handlers , obj .name )
104
+ if obj .name not in python .__all__ or not hasattr (python , obj .name )
105
105
]
106
106
assert not not_exposed , "Objects not exposed:\n " + "\n " .join (sorted (not_exposed ))
107
107
@@ -122,7 +122,7 @@ def _public_path(obj: griffe.Object | griffe.Alias) -> bool:
122
122
return obj .is_public and (obj .parent is None or _public_path (obj .parent ))
123
123
124
124
multiple_locations = {}
125
- for obj_name in mkdocstrings_handlers .__all__ :
125
+ for obj_name in python .__all__ :
126
126
obj = public_api [obj_name ]
127
127
if obj .aliases and (
128
128
public_aliases := [path for path , alias in obj .aliases .items () if path != obj .path and _public_path (alias )]
@@ -152,6 +152,7 @@ def test_inventory_matches_api(
152
152
not_in_api = []
153
153
public_api_paths = {obj .path for obj in public_objects }
154
154
public_api_paths .add ("mkdocstrings_handlers" )
155
+ public_api_paths .add ("mkdocstrings_handlers.python" )
155
156
for item in inventory .values ():
156
157
if item .domain == "py" and "(" not in item .name :
157
158
obj = loader .modules_collection [item .name ]
0 commit comments