Skip to content

Commit f038c23

Browse files
authored
Merge pull request #204 from sethmlarson/spdx-id-collision
Add test case for SPDX ID collisions
2 parents b37e7f7 + ca6c379 commit f038c23

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/test_sbom.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ def test_spdx_id(value: str, expected: str) -> None:
2727
assert sbom.spdx_id(value) == expected
2828

2929

30+
def test_spdx_id_collisions():
31+
sbom._SPDX_IDS_TO_VALUES = {} # Reset the cache.
32+
assert (
33+
sbom.spdx_id("SPDXRef-FILE-Lib/collections.py")
34+
== "SPDXRef-FILE-Lib-collections.py"
35+
)
36+
assert (
37+
sbom.spdx_id("SPDXRef-FILE-Lib/_collections.py")
38+
== "SPDXRef-FILE-Lib-collections.py-fc43043d"
39+
)
40+
41+
3042
@pytest.mark.parametrize(
3143
["package_sha1s", "package_verification_code"],
3244
[

0 commit comments

Comments
 (0)