4
4
import os
5
5
import tempfile
6
6
import unittest
7
- from unittest .mock import MagicMock , patch
8
7
from datetime import datetime , timedelta
8
+ from unittest .mock import patch
9
+
9
10
from classes import IssueWithMetrics
10
- from markdown_writer import write_to_markdown
11
11
from json_writer import write_to_json
12
+ from markdown_writer import write_to_markdown
12
13
13
14
14
15
class TestAssigneeIntegration (unittest .TestCase ):
@@ -47,14 +48,22 @@ def test_assignee_in_markdown_output(self):
47
48
),
48
49
]
49
50
50
- with tempfile .NamedTemporaryFile (mode = 'w' , suffix = ' .md' , delete = False ) as f :
51
+ with tempfile .NamedTemporaryFile (mode = "w" , suffix = " .md" , delete = False ) as f :
51
52
output_file = f .name
52
53
53
54
try :
54
55
write_to_markdown (
55
56
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
+ },
58
67
average_time_to_answer = None ,
59
68
average_time_in_draft = None ,
60
69
average_time_in_labels = None ,
@@ -73,18 +82,18 @@ def test_assignee_in_markdown_output(self):
73
82
)
74
83
75
84
# 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 :
77
86
content = f .read ()
78
87
79
88
# Check for assignee column header
80
89
self .assertIn ("| Assignee |" , content )
81
-
90
+
82
91
# Check for assignee data - alice should be linked
83
92
self .assertIn ("[alice](https://github.com/alice)" , content )
84
-
93
+
85
94
# Check for None assignee
86
95
self .assertIn ("| None |" , content )
87
-
96
+
88
97
# Check that both assignee and author columns are present
89
98
self .assertIn ("| Author |" , content )
90
99
@@ -116,14 +125,22 @@ def test_assignee_in_json_output(self):
116
125
),
117
126
]
118
127
119
- with tempfile .NamedTemporaryFile (mode = 'w' , suffix = ' .json' , delete = False ) as f :
128
+ with tempfile .NamedTemporaryFile (mode = "w" , suffix = " .json" , delete = False ) as f :
120
129
output_file = f .name
121
130
122
131
try :
123
132
json_output = write_to_json (
124
133
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
+ },
127
144
stats_time_to_answer = None ,
128
145
stats_time_in_draft = None ,
129
146
stats_time_in_labels = None ,
0 commit comments