@@ -168,6 +168,70 @@ def test_get_developer_categories(self):
168
168
categories = self .analyzer .get_developer_categories ()
169
169
self .assertDictEqual (categories , {"core" : 2 , "regular" : 1 , "casual" : 1 })
170
170
171
+ def test_get_categories_one_developer (self ):
172
+ """Test if the categories are calculated correctly when there is only one developer"""
173
+
174
+ categories = self .analyzer .get_developer_categories ()
175
+ self .assertDictEqual (categories , {"core" : 0 , "regular" : 0 , "casual" : 0 })
176
+
177
+ # Add a core developer with 100% of the contributions
178
+ extra_events = [
179
+ {
180
+ "type" : "org.grimoirelab.events.git.commit" ,
181
+ "data" : {"Author" : "Author 1 <author1@example_new.com>" , "message" : "Another commit" },
182
+ },
183
+ {
184
+ "type" : "org.grimoirelab.events.git.commit" ,
185
+ "data" : {"Author" : "Author 1 <author1@example_new.com>" , "message" : "Another commit" },
186
+ },
187
+ {
188
+ "type" : "org.grimoirelab.events.git.commit" ,
189
+ "data" : {"Author" : "Author 1 <author1@example_new.com>" , "message" : "Another commit" },
190
+ },
191
+ {
192
+ "type" : "org.grimoirelab.events.git.commit" ,
193
+ "data" : {"Author" : "Author 1 <author1@example_new.com>" , "message" : "Another commit" },
194
+ },
195
+ ]
196
+
197
+ self .analyzer .process_events (extra_events )
198
+ categories = self .analyzer .get_developer_categories ()
199
+ self .assertDictEqual (categories , {"core" : 1 , "regular" : 0 , "casual" : 0 })
200
+
201
+ def test_get_developer_categories_tied (self ):
202
+ """Test if the categories are calculated correctly when the core developers have the same contributions"""
203
+
204
+ categories = self .analyzer .get_developer_categories ()
205
+ self .assertDictEqual (categories , {"core" : 0 , "regular" : 0 , "casual" : 0 })
206
+
207
+ # Add core developers with the same number of contributions
208
+ extra_events = [
209
+ {
210
+ "type" : "org.grimoirelab.events.git.commit" ,
211
+ "data" : {"Author" : "Author 1 <author1@example_new.com>" , "message" : "Another commit" },
212
+ },
213
+ {
214
+ "type" : "org.grimoirelab.events.git.commit" ,
215
+ "data" : {"Author" : "Author 2 <author2@example_new.com>" , "message" : "Another commit" },
216
+ },
217
+ {
218
+ "type" : "org.grimoirelab.events.git.commit" ,
219
+ "data" : {"Author" : "Author 3 <author3@example_new.com>" , "message" : "Another commit" },
220
+ },
221
+ {
222
+ "type" : "org.grimoirelab.events.git.commit" ,
223
+ "data" : {"Author" : "Author 4 <author4@example_new.com>" , "message" : "Another commit" },
224
+ },
225
+ {
226
+ "type" : "org.grimoirelab.events.git.commit" ,
227
+ "data" : {"Author" : "Author 5 <author5@example_new.com>" , "message" : "Another commit" },
228
+ },
229
+ ]
230
+
231
+ self .analyzer .process_events (extra_events )
232
+ categories = self .analyzer .get_developer_categories ()
233
+ self .assertDictEqual (categories , {"core" : 4 , "regular" : 1 , "casual" : 0 })
234
+
171
235
172
236
if __name__ == "__main__" :
173
237
unittest .main ()
0 commit comments