@@ -95,6 +95,89 @@ def test_assignee_column_position(self):
95
95
"Assignee column should appear before Author column" ,
96
96
)
97
97
98
+ def test_multiple_assignees_rendering_logic (self ):
99
+ """Test that multiple assignees are rendered correctly in assignee column."""
100
+ from classes import IssueWithMetrics
101
+ from io import StringIO
102
+
103
+ # Test the assignee rendering logic directly
104
+ endpoint = "github.com"
105
+ columns = ["Title" , "URL" , "Assignee" , "Author" ]
106
+
107
+ # Test case 1: Multiple assignees
108
+ issue_multiple = IssueWithMetrics (
109
+ title = "Test Issue with Multiple Assignees" ,
110
+ html_url = "https://github.com/test/repo/issues/1" ,
111
+ author = "testuser" ,
112
+ assignee = "alice" ,
113
+ assignees = ["alice" , "bob" , "charlie" ]
114
+ )
115
+
116
+ # Simulate the new rendering logic
117
+ if "Assignee" in columns :
118
+ if issue_multiple .assignees :
119
+ assignee_links = [
120
+ f"[{ assignee } ](https://{ endpoint } /{ assignee } )"
121
+ for assignee in issue_multiple .assignees
122
+ ]
123
+ multiple_output = f" { ', ' .join (assignee_links )} |"
124
+ else :
125
+ multiple_output = " None |"
126
+
127
+ expected_multiple = " [alice](https://github.com/alice), [bob](https://github.com/bob), [charlie](https://github.com/charlie) |"
128
+ self .assertEqual (multiple_output , expected_multiple ,
129
+ "Multiple assignees should be rendered as comma-separated links" )
130
+
131
+ # Test case 2: Single assignee
132
+ issue_single = IssueWithMetrics (
133
+ title = "Test Issue with Single Assignee" ,
134
+ html_url = "https://github.com/test/repo/issues/2" ,
135
+ author = "testuser" ,
136
+ assignee = "alice" ,
137
+ assignees = ["alice" ]
138
+ )
139
+
140
+ if "Assignee" in columns :
141
+ if issue_single .assignees :
142
+ assignee_links = [
143
+ f"[{ assignee } ](https://{ endpoint } /{ assignee } )"
144
+ for assignee in issue_single .assignees
145
+ ]
146
+ single_output = f" { ', ' .join (assignee_links )} |"
147
+ else :
148
+ single_output = " None |"
149
+
150
+ expected_single = " [alice](https://github.com/alice) |"
151
+ self .assertEqual (single_output , expected_single ,
152
+ "Single assignee should be rendered as a single link" )
153
+
154
+ # Test case 3: No assignees
155
+ issue_none = IssueWithMetrics (
156
+ title = "Test Issue with No Assignees" ,
157
+ html_url = "https://github.com/test/repo/issues/3" ,
158
+ author = "testuser" ,
159
+ assignee = None ,
160
+ assignees = []
161
+ )
162
+
163
+ if "Assignee" in columns :
164
+ if issue_none .assignees :
165
+ assignee_links = [
166
+ f"[{ assignee } ](https://{ endpoint } /{ assignee } )"
167
+ for assignee in issue_none .assignees
168
+ ]
169
+ none_output = f" { ', ' .join (assignee_links )} |"
170
+ else :
171
+ none_output = " None |"
172
+
173
+ expected_none = " None |"
174
+ self .assertEqual (none_output , expected_none ,
175
+ "No assignees should be rendered as 'None'" )
176
+
177
+ print (f"✅ Multiple assignees test: { expected_multiple } " )
178
+ print (f"✅ Single assignee test: { expected_single } " )
179
+ print (f"✅ No assignees test: { expected_none } " )
180
+
98
181
99
182
if __name__ == "__main__" :
100
183
unittest .main ()
0 commit comments