@@ -233,6 +233,36 @@ def test_measure_time_to_first_response_ignore_users(self):
233
233
# Check the results
234
234
self .assertEqual (result , expected_result )
235
235
236
+ def test_measure_time_to_first_response_ignore_pending_review (self ):
237
+ """Test that measure_time_to_first_response ignores pending reviews"""
238
+
239
+ mock_issue1 = MagicMock ()
240
+ mock_issue1 .comments = 2
241
+ mock_issue1 .issue .user .login = "issue_owner"
242
+ mock_issue1 .created_at = "2023-01-01T00:00:00Z"
243
+
244
+ # Set up the mock GitHub pull request comments (one ignored, one not ignored)
245
+ # Pending Review
246
+ mock_pr_comment1 = MagicMock ()
247
+ mock_pr_comment1 .submitted_at = None
248
+ # Submitted Comment
249
+ mock_pr_comment2 = MagicMock ()
250
+ mock_pr_comment2 .submitted_at = datetime .fromisoformat ("2023-01-04T00:00:00Z" )
251
+
252
+ mock_pull_request = MagicMock ()
253
+ mock_pull_request .reviews .return_value = [mock_pr_comment1 , mock_pr_comment2 ]
254
+
255
+ ready_for_review_at = datetime .fromisoformat ("2023-01-03T00:00:00Z" )
256
+
257
+ # Call the function
258
+ result = measure_time_to_first_response (
259
+ mock_issue1 , None , mock_pull_request , ready_for_review_at
260
+ )
261
+ expected_result = timedelta (days = 1 )
262
+
263
+ # Check the results
264
+ self .assertEqual (result , expected_result )
265
+
236
266
def test_measure_time_to_first_response_only_ignored_users (self ):
237
267
"""Test that measure_time_to_first_response returns empty for an issue with only ignored users."""
238
268
# Set up the mock GitHub issues
0 commit comments