1- # Copyright (c) 2024 - 2024 , Oracle and/or its affiliates. All rights reserved.
1+ # Copyright (c) 2024 - 2025 , Oracle and/or its affiliates. All rights reserved.
22# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
33
44"""Tests for high release frequency heuristic."""
55
66from unittest .mock import MagicMock
77
8+ import pytest
9+
10+ from macaron .errors import HeuristicAnalyzerValueError
811from macaron .malware_analyzer .pypi_heuristics .heuristics import HeuristicResult
912from macaron .malware_analyzer .pypi_heuristics .metadata .high_release_frequency import HighReleaseFrequencyAnalyzer
1013
@@ -59,8 +62,8 @@ def test_analyze_low_frequency_fail(pypi_package_json: MagicMock) -> None:
5962 assert detail_info == {"frequency" : 1 }
6063
6164
62- def test_analyze_no_releases_skip (pypi_package_json : MagicMock ) -> None :
63- """Test HighReleaseFrequencyAnalyzer when no releases are available (should skip ).
65+ def test_analyze_no_releases (pypi_package_json : MagicMock ) -> None :
66+ """Test HighReleaseFrequencyAnalyzer when no releases are available (should error for a malformed package ).
6467
6568 Parameters
6669 ----------
@@ -73,11 +76,8 @@ def test_analyze_no_releases_skip(pypi_package_json: MagicMock) -> None:
7376 pypi_package_json .get_releases .return_value = None
7477
7578 # Call the method.
76- result , detail_info = analyzer .analyze (pypi_package_json )
77-
78- # Assert.
79- assert result == HeuristicResult .SKIP
80- assert not detail_info
79+ with pytest .raises (HeuristicAnalyzerValueError ):
80+ _ = analyzer .analyze (pypi_package_json )
8181
8282
8383def test_analyze_single_release_skip (pypi_package_json : MagicMock ) -> None :
0 commit comments