Skip to content

Commit ca6c379

Browse files
committed
Add test case for SPDX ID collisions
1 parent 21d18fc commit ca6c379

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)