Skip to content

Commit

Permalink
Remove matches_all API
Browse files Browse the repository at this point in the history
We don't use it and I don't know the use-case for it.
This simplifies public API for the library.
  • Loading branch information
kissgyorgy committed Nov 15, 2024
1 parent b6a4dd1 commit ab89f3d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 35 deletions.
8 changes: 0 additions & 8 deletions cpematcher/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ class CPE:
"other",
]

@property
def matches_all(self):
return self.version == "*" and not (
self.version_start_including
or self.version_start_excluding
or self.version_end_including
or self.version_end_excluding
)

def __init__(
self,
Expand Down
27 changes: 0 additions & 27 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,6 @@ def test_init_with_invalid_number_of_values_in_cpe_str(self):
with pytest.raises(ValueError):
CPE("cpe:2.3:a:apache:activemq:4.0.1:*:*:*:*:*")

def test_matches_all(self):
cpe = CPE("cpe:2.3:a:apache:activemq:4.0.1:*:*:*:*:*:*:*")
assert not cpe.matches_all

cpe = CPE("cpe:2.3:a:apache:activemq:*:*:*:*:*:*:*:*")
assert cpe.matches_all

cpe = CPE(
"cpe:2.3:a:apache:activemq:*:*:*:*:*:*:*:*", version_start_including="1"
)
assert not cpe.matches_all

cpe = CPE(
"cpe:2.3:a:apache:activemq:*:*:*:*:*:*:*:*", version_start_excluding="1"
)
assert not cpe.matches_all

cpe = CPE(
"cpe:2.3:a:apache:activemq:*:*:*:*:*:*:*:*", version_end_including="1"
)
assert not cpe.matches_all

cpe = CPE(
"cpe:2.3:a:apache:activemq:*:*:*:*:*:*:*:*", version_end_excluding="1"
)
assert not cpe.matches_all

def test_matches_with_wildcard(self):
master_cpe = CPE("cpe:2.3:a:apache:activemq:*:*:*:*:*:*:*:*")
version_cpe = CPE("cpe:2.3:a:apache:activemq:4.0.1:*:*:*:*:*:*:*")
Expand Down

0 comments on commit ab89f3d

Please sign in to comment.