Skip to content

Commit 24c79ea

Browse files
committed
Also raise ValueError on construction if the value is invalid.
1 parent ee4f987 commit 24c79ea

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

importlib_metadata/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,14 @@ class EntryPoint:
170170
Traceback (most recent call last):
171171
...
172172
ValueError: ('Invalid object reference...invalid-name...
173+
174+
The same thing happens on construction.
175+
176+
>>> EntryPoint(name=None, group=None, value='invalid-name')
177+
Traceback (most recent call last):
178+
...
179+
ValueError: ('Invalid object reference...invalid-name...
180+
173181
"""
174182

175183
pattern = re.compile(
@@ -201,6 +209,7 @@ class EntryPoint:
201209

202210
def __init__(self, name: str, value: str, group: str) -> None:
203211
vars(self).update(name=name, value=value, group=group)
212+
self.module
204213

205214
def load(self) -> Any:
206215
"""Load the entry point from its definition. If only a module

0 commit comments

Comments
 (0)