Skip to content

Commit f179e28

Browse files
committed
Also raise ValueError on construction if the value is invalid.
1 parent eae6a75 commit f179e28

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
@@ -171,6 +171,14 @@ class EntryPoint:
171171
Traceback (most recent call last):
172172
...
173173
ValueError: ('Invalid object reference...invalid-name...
174+
175+
The same thing happens on construction.
176+
177+
>>> EntryPoint(name=None, group=None, value='invalid-name')
178+
Traceback (most recent call last):
179+
...
180+
ValueError: ('Invalid object reference...invalid-name...
181+
174182
"""
175183

176184
pattern = re.compile(
@@ -202,6 +210,7 @@ class EntryPoint:
202210

203211
def __init__(self, name: str, value: str, group: str) -> None:
204212
vars(self).update(name=name, value=value, group=group)
213+
self.module
205214

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

0 commit comments

Comments
 (0)