44import os
55import tempfile
66import unittest
7- from unittest .mock import MagicMock , patch
87from datetime import datetime , timedelta
8+ from unittest .mock import patch
9+
910from classes import IssueWithMetrics
10- from markdown_writer import write_to_markdown
1111from json_writer import write_to_json
12+ from markdown_writer import write_to_markdown
1213
1314
1415class TestAssigneeIntegration (unittest .TestCase ):
@@ -47,14 +48,22 @@ def test_assignee_in_markdown_output(self):
4748 ),
4849 ]
4950
50- with tempfile .NamedTemporaryFile (mode = 'w' , suffix = ' .md' , delete = False ) as f :
51+ with tempfile .NamedTemporaryFile (mode = "w" , suffix = " .md" , delete = False ) as f :
5152 output_file = f .name
5253
5354 try :
5455 write_to_markdown (
5556 issues_with_metrics = issues_with_metrics ,
56- average_time_to_first_response = {"avg" : timedelta (hours = 3 ), "med" : timedelta (hours = 3 ), "90p" : timedelta (hours = 4 )},
57- average_time_to_close = {"avg" : timedelta (days = 1 ), "med" : timedelta (days = 1 ), "90p" : timedelta (days = 1 )},
57+ average_time_to_first_response = {
58+ "avg" : timedelta (hours = 3 ),
59+ "med" : timedelta (hours = 3 ),
60+ "90p" : timedelta (hours = 4 ),
61+ },
62+ average_time_to_close = {
63+ "avg" : timedelta (days = 1 ),
64+ "med" : timedelta (days = 1 ),
65+ "90p" : timedelta (days = 1 ),
66+ },
5867 average_time_to_answer = None ,
5968 average_time_in_draft = None ,
6069 average_time_in_labels = None ,
@@ -73,18 +82,18 @@ def test_assignee_in_markdown_output(self):
7382 )
7483
7584 # Read and verify the markdown content
76- with open (output_file , 'r' ) as f :
85+ with open (output_file , "r" , encoding = "utf-8" ) as f :
7786 content = f .read ()
7887
7988 # Check for assignee column header
8089 self .assertIn ("| Assignee |" , content )
81-
90+
8291 # Check for assignee data - alice should be linked
8392 self .assertIn ("[alice](https://github.com/alice)" , content )
84-
93+
8594 # Check for None assignee
8695 self .assertIn ("| None |" , content )
87-
96+
8897 # Check that both assignee and author columns are present
8998 self .assertIn ("| Author |" , content )
9099
@@ -116,14 +125,22 @@ def test_assignee_in_json_output(self):
116125 ),
117126 ]
118127
119- with tempfile .NamedTemporaryFile (mode = 'w' , suffix = ' .json' , delete = False ) as f :
128+ with tempfile .NamedTemporaryFile (mode = "w" , suffix = " .json" , delete = False ) as f :
120129 output_file = f .name
121130
122131 try :
123132 json_output = write_to_json (
124133 issues_with_metrics = issues_with_metrics ,
125- stats_time_to_first_response = {"avg" : timedelta (hours = 3 ), "med" : timedelta (hours = 3 ), "90p" : timedelta (hours = 4 )},
126- stats_time_to_close = {"avg" : timedelta (days = 1 ), "med" : timedelta (days = 1 ), "90p" : timedelta (days = 1 )},
134+ stats_time_to_first_response = {
135+ "avg" : timedelta (hours = 3 ),
136+ "med" : timedelta (hours = 3 ),
137+ "90p" : timedelta (hours = 4 ),
138+ },
139+ stats_time_to_close = {
140+ "avg" : timedelta (days = 1 ),
141+ "med" : timedelta (days = 1 ),
142+ "90p" : timedelta (days = 1 ),
143+ },
127144 stats_time_to_answer = None ,
128145 stats_time_in_draft = None ,
129146 stats_time_in_labels = None ,
0 commit comments