11import unittest
2- from decimal import Decimal
32from unittest .mock import MagicMock , patch
43
54from services .comparison import ComparisonProxy
65from services .notification .notifiers .base import AbstractBaseNotifier
76from services .notification .notifiers .comment .conditions import (
87 HasEnoughRequiredChanges ,
9- NotifyCondition ,
108)
11- from shared .validation .types import CoverageCommentRequiredChanges
129
1310
1411class TestHasEnoughRequiredChanges (unittest .TestCase ):
@@ -17,38 +14,29 @@ def setUp(self):
1714 self .comparison = MagicMock (spec = ComparisonProxy )
1815
1916 def test_check_coverage_change_with_none_diff (self ):
20- # Arrange
2117 self .comparison .get_diff .return_value = None
22-
23- # Act
2418 result = HasEnoughRequiredChanges ._check_coverage_change (self .comparison )
25-
26- # Assert
2719 self .assertFalse (result )
2820 self .comparison .get_diff .assert_called_once ()
2921 self .comparison .head .report .calculate_diff .assert_not_called ()
3022
3123 def test_check_uncovered_patch_with_none_diff (self ):
32- # Arrange
3324 self .comparison .get_diff .return_value = None
34-
35- # Act
3625 result = HasEnoughRequiredChanges ._check_uncovered_patch (self .comparison )
37-
38- # Assert
3926 self .assertFalse (result )
4027 self .comparison .get_diff .assert_called_once_with (use_original_base = True )
4128 self .comparison .head .report .apply_diff .assert_not_called ()
4229
4330 def test_check_any_change_with_none_diff (self ):
44- # Arrange
4531 self .comparison .get_diff .return_value = None
46-
32+
4733 # Mock _check_unexpected_changes to return False
48- with patch .object (HasEnoughRequiredChanges , '_check_unexpected_changes' , return_value = False ):
34+ with patch .object (
35+ HasEnoughRequiredChanges , "_check_unexpected_changes" , return_value = False
36+ ):
4937 # Act
5038 result = HasEnoughRequiredChanges ._check_any_change (self .comparison )
51-
39+
5240 # Assert
5341 self .assertFalse (result )
54- self .comparison .get_diff .assert_called_once ()
42+ self .comparison .get_diff .assert_called_once ()
0 commit comments