Skip to content

Commit 7a3a883

Browse files
zkoppertCopilot
andcommitted
fix: correct TypeError test to actually exercise exception handler
The test_measure_time_to_first_review_type_error_path test was passing but not actually reaching the except TypeError block. The MagicMock review's submitted_at (a MagicMock, not a datetime) caused ignore_comment to skip the review as 'pending', so first_review_time stayed None and the function returned before the TypeError could occur. Use side_effect to raise TypeError directly from the reviews() call, which properly exercises the exception handling path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 8bd2f25 commit 7a3a883

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

test_time_to_first_review.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ def test_measure_time_to_first_review_ignore_users(self):
115115
def test_measure_time_to_first_review_type_error_path(self):
116116
"""Test the except TypeError error handling path."""
117117
mock_issue = MagicMock()
118-
mock_issue.created_at = 12345
118+
mock_issue.created_at = "2023-01-01T00:00:00Z"
119119

120120
mock_pr = MagicMock()
121-
mock_pr.reviews.return_value = [MagicMock()]
121+
mock_pr.reviews.side_effect = TypeError("ghost user")
122122

123123
result = measure_time_to_first_review(mock_issue, mock_pr, None, [])
124124
self.assertIsNone(result)

0 commit comments

Comments
 (0)