1717
1818
1919@pytest .fixture (name = "loader" , scope = "module" )
20- def _fixture_loader () -> griffelib .GriffeLoader :
21- loader = griffelib .GriffeLoader (
22- extensions = griffelib .load_extensions (
20+ def _fixture_loader () -> griffe .GriffeLoader :
21+ loader = griffe .GriffeLoader (
22+ extensions = griffe .load_extensions (
2323 "griffe_inherited_docstrings" ,
2424 "unpack_typeddict" ,
2525 ),
@@ -30,23 +30,23 @@ def _fixture_loader() -> griffelib.GriffeLoader:
3030
3131
3232@pytest .fixture (name = "internal_api" , scope = "module" )
33- def _fixture_internal_api (loader : griffelib .GriffeLoader ) -> griffelib .Module :
34- return loader .modules_collection ["griffelib ._internal" ]
33+ def _fixture_internal_api (loader : griffe .GriffeLoader ) -> griffe .Module :
34+ return loader .modules_collection ["griffe ._internal" ]
3535
3636
3737@pytest .fixture (name = "public_api" , scope = "module" )
38- def _fixture_public_api (loader : griffelib .GriffeLoader ) -> griffelib .Module :
38+ def _fixture_public_api (loader : griffe .GriffeLoader ) -> griffe .Module :
3939 return loader .modules_collection ["griffe" ]
4040
4141
4242def _yield_public_objects (
43- obj : griffelib .Module | griffelib .Class ,
43+ obj : griffe .Module | griffe .Class ,
4444 * ,
4545 modules : bool = False ,
4646 modulelevel : bool = True ,
4747 inherited : bool = False ,
4848 special : bool = False ,
49- ) -> Iterator [griffelib .Object | griffelib .Alias ]:
49+ ) -> Iterator [griffe .Object | griffe .Alias ]:
5050 for member in obj .all_members .values () if inherited else obj .members .values ():
5151 try :
5252 if member .is_module :
@@ -72,22 +72,22 @@ def _yield_public_objects(
7272 inherited = inherited ,
7373 special = special ,
7474 )
75- except (griffelib .AliasResolutionError , griffelib .CyclicAliasError ):
75+ except (griffe .AliasResolutionError , griffe .CyclicAliasError ):
7676 continue
7777
7878
7979@pytest .fixture (name = "modulelevel_internal_objects" , scope = "module" )
80- def _fixture_modulelevel_internal_objects (internal_api : griffelib .Module ) -> list [griffelib .Object | griffelib .Alias ]:
80+ def _fixture_modulelevel_internal_objects (internal_api : griffe .Module ) -> list [griffe .Object | griffe .Alias ]:
8181 return list (_yield_public_objects (internal_api , modulelevel = True ))
8282
8383
8484@pytest .fixture (name = "internal_objects" , scope = "module" )
85- def _fixture_internal_objects (internal_api : griffelib .Module ) -> list [griffelib .Object | griffelib .Alias ]:
85+ def _fixture_internal_objects (internal_api : griffe .Module ) -> list [griffe .Object | griffe .Alias ]:
8686 return list (_yield_public_objects (internal_api , modulelevel = False , special = True ))
8787
8888
8989@pytest .fixture (name = "public_objects" , scope = "module" )
90- def _fixture_public_objects (public_api : griffelib .Module ) -> list [griffelib .Object | griffelib .Alias ]:
90+ def _fixture_public_objects (public_api : griffe .Module ) -> list [griffe .Object | griffe .Alias ]:
9191 return list (_yield_public_objects (public_api , modulelevel = False , inherited = True , special = True ))
9292
9393
@@ -100,7 +100,7 @@ def _fixture_inventory() -> Inventory:
100100 return Inventory .parse_sphinx (file )
101101
102102
103- def test_alias_proxies (internal_api : griffelib .Module ) -> None :
103+ def test_alias_proxies (internal_api : griffe .Module ) -> None :
104104 """The Alias class has all the necessary methods and properties."""
105105 alias_members = set (internal_api ["models.Alias" ].all_members .keys ())
106106 for cls in (
@@ -114,17 +114,17 @@ def test_alias_proxies(internal_api: griffelib.Module) -> None:
114114 assert name in alias_members
115115
116116
117- def test_exposed_objects (modulelevel_internal_objects : list [griffelib .Object | griffelib .Alias ]) -> None :
117+ def test_exposed_objects (modulelevel_internal_objects : list [griffe .Object | griffe .Alias ]) -> None :
118118 """All public objects in the internal API are exposed under `griffe`."""
119119 not_exposed = [
120120 obj .path
121121 for obj in modulelevel_internal_objects
122- if obj .name not in griffelib .__all__ or not hasattr (griffe , obj .name )
122+ if obj .name not in griffe .__all__ or not hasattr (griffe , obj .name )
123123 ]
124124 assert not not_exposed , "Objects not exposed:\n " + "\n " .join (sorted (not_exposed ))
125125
126126
127- def test_unique_names (modulelevel_internal_objects : list [griffelib .Object | griffelib .Alias ]) -> None :
127+ def test_unique_names (modulelevel_internal_objects : list [griffe .Object | griffe .Alias ]) -> None :
128128 """All internal objects have unique names."""
129129 names_to_paths = defaultdict (list )
130130 for obj in modulelevel_internal_objects :
@@ -133,14 +133,14 @@ def test_unique_names(modulelevel_internal_objects: list[griffelib.Object | grif
133133 assert not non_unique , "Non-unique names:\n " + "\n " .join (str (paths ) for paths in non_unique )
134134
135135
136- def test_single_locations (public_api : griffelib .Module ) -> None :
136+ def test_single_locations (public_api : griffe .Module ) -> None :
137137 """All objects have a single public location."""
138138
139- def _public_path (obj : griffelib .Object | griffelib .Alias ) -> bool :
139+ def _public_path (obj : griffe .Object | griffe .Alias ) -> bool :
140140 return obj .is_public and (obj .parent is None or _public_path (obj .parent ))
141141
142142 multiple_locations = {}
143- for obj_name in griffelib .__all__ :
143+ for obj_name in griffe .__all__ :
144144 obj = public_api [obj_name ]
145145 if obj .aliases and (
146146 public_aliases := [path for path , alias in obj .aliases .items () if path != obj .path and _public_path (alias )]
@@ -151,10 +151,10 @@ def _public_path(obj: griffelib.Object | griffelib.Alias) -> bool:
151151 )
152152
153153
154- def test_api_matches_inventory (inventory : Inventory , public_objects : list [griffelib .Object | griffelib .Alias ]) -> None :
154+ def test_api_matches_inventory (inventory : Inventory , public_objects : list [griffe .Object | griffe .Alias ]) -> None :
155155 """All public objects are added to the inventory."""
156156 ignore_names = {"__getattr__" , "__init__" , "__repr__" , "__str__" , "__post_init__" }
157- ignore_paths = {"griffelib .DataclassesExtension.*" , "griffelib .UnpackTypedDictExtension.*" }
157+ ignore_paths = {"griffe .DataclassesExtension.*" , "griffe .UnpackTypedDictExtension.*" }
158158 not_in_inventory = [
159159 f"{ obj .relative_filepath } :{ obj .lineno } : { obj .path } "
160160 for obj in public_objects
@@ -170,8 +170,8 @@ def test_api_matches_inventory(inventory: Inventory, public_objects: list[griffe
170170
171171def test_inventory_matches_api (
172172 inventory : Inventory ,
173- public_objects : list [griffelib .Object | griffelib .Alias ],
174- loader : griffelib .GriffeLoader ,
173+ public_objects : list [griffe .Object | griffe .Alias ],
174+ loader : griffe .GriffeLoader ,
175175) -> None :
176176 """The inventory doesn't contain any additional Python object."""
177177 not_in_api = []
@@ -186,14 +186,14 @@ def test_inventory_matches_api(
186186 assert not not_in_api , msg .format (paths = "\n " .join (sorted (not_in_api )))
187187
188188
189- def test_no_module_docstrings_in_internal_api (internal_api : griffelib .Module ) -> None :
189+ def test_no_module_docstrings_in_internal_api (internal_api : griffe .Module ) -> None :
190190 """No module docstrings should be written in our internal API.
191191
192192 The reasoning is that docstrings are addressed to users of the public API,
193193 but internal modules are not exposed to users, so they should not have docstrings.
194194 """
195195
196- def _modules (obj : griffelib .Module ) -> Iterator [griffelib .Module ]:
196+ def _modules (obj : griffe .Module ) -> Iterator [griffe .Module ]:
197197 for member in obj .modules .values ():
198198 yield member
199199 yield from _modules (member )
0 commit comments