Skip to content

Commit ba4a115

Browse files
committed
Ensure doctest pass correctly
Signed-off-by: Philippe Ombredanne <[email protected]>
1 parent 090130a commit ba4a115

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

vulnerabilities/importers/github.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,16 @@ def advisory_data(self) -> Iterable[AdvisoryData]:
184184

185185
def get_purl(pkg_type: str, github_name: str) -> Optional[PackageURL]:
186186
"""
187-
Return a PackageURL by splitting the `github_name` using the `pkg_type` convention.
188-
Return None and log an error if we can not split or it is an unknown package type.
189-
>>> get_purl("maven", "org.apache.commons:commons-lang3")
190-
PackageURL(type="maven", namespace="org.apache.commons", name="commons-lang3")
191-
>>> get_purl("composer", "foo/bar")
192-
PackageURL(type="composer", namespace="foo", name="bar")
187+
Return a PackageURL by splitting the `github_name` using the `pkg_type`
188+
convention. Return None and log an error if we can not split or it is an
189+
unknown package type.
190+
191+
For example::
192+
>>> expected = PackageURL(type='maven', namespace='org.apache.commons', name='commons-lang3')
193+
>>> assert get_purl("maven", "org.apache.commons:commons-lang3") == expected
194+
195+
>>> expected = PackageURL(type="composer", namespace="foo", name="bar")
196+
>>> assert get_purl("composer", "foo/bar") == expected
193197
"""
194198
if pkg_type == "maven":
195199
if ":" not in github_name:

0 commit comments

Comments
 (0)