@@ -216,6 +216,70 @@ def test_get_developer_categories(self):
216
216
categories = self .analyzer .get_developer_categories ()
217
217
self .assertDictEqual (categories , {"core" : 2 , "regular" : 1 , "casual" : 1 })
218
218
219
+ def test_get_categories_one_developer (self ):
220
+ """Test if the categories are calculated correctly when there is only one developer"""
221
+
222
+ categories = self .analyzer .get_developer_categories ()
223
+ self .assertDictEqual (categories , {"core" : 0 , "regular" : 0 , "casual" : 0 })
224
+
225
+ # Add a core developer with 100% of the contributions
226
+ extra_events = [
227
+ {
228
+ "type" : "org.grimoirelab.events.git.commit" ,
229
+ "data" : {"Author" : "Author 1 <author1@example_new.com>" , "message" : "Another commit" },
230
+ },
231
+ {
232
+ "type" : "org.grimoirelab.events.git.commit" ,
233
+ "data" : {"Author" : "Author 1 <author1@example_new.com>" , "message" : "Another commit" },
234
+ },
235
+ {
236
+ "type" : "org.grimoirelab.events.git.commit" ,
237
+ "data" : {"Author" : "Author 1 <author1@example_new.com>" , "message" : "Another commit" },
238
+ },
239
+ {
240
+ "type" : "org.grimoirelab.events.git.commit" ,
241
+ "data" : {"Author" : "Author 1 <author1@example_new.com>" , "message" : "Another commit" },
242
+ },
243
+ ]
244
+
245
+ self .analyzer .process_events (extra_events )
246
+ categories = self .analyzer .get_developer_categories ()
247
+ self .assertDictEqual (categories , {"core" : 1 , "regular" : 0 , "casual" : 0 })
248
+
249
+ def test_get_developer_categories_tied (self ):
250
+ """Test if the categories are calculated correctly when the core developers have the same contributions"""
251
+
252
+ categories = self .analyzer .get_developer_categories ()
253
+ self .assertDictEqual (categories , {"core" : 0 , "regular" : 0 , "casual" : 0 })
254
+
255
+ # Add core developers with the same number of contributions
256
+ extra_events = [
257
+ {
258
+ "type" : "org.grimoirelab.events.git.commit" ,
259
+ "data" : {"Author" : "Author 1 <author1@example_new.com>" , "message" : "Another commit" },
260
+ },
261
+ {
262
+ "type" : "org.grimoirelab.events.git.commit" ,
263
+ "data" : {"Author" : "Author 2 <author2@example_new.com>" , "message" : "Another commit" },
264
+ },
265
+ {
266
+ "type" : "org.grimoirelab.events.git.commit" ,
267
+ "data" : {"Author" : "Author 3 <author3@example_new.com>" , "message" : "Another commit" },
268
+ },
269
+ {
270
+ "type" : "org.grimoirelab.events.git.commit" ,
271
+ "data" : {"Author" : "Author 4 <author4@example_new.com>" , "message" : "Another commit" },
272
+ },
273
+ {
274
+ "type" : "org.grimoirelab.events.git.commit" ,
275
+ "data" : {"Author" : "Author 5 <author5@example_new.com>" , "message" : "Another commit" },
276
+ },
277
+ ]
278
+
279
+ self .analyzer .process_events (extra_events )
280
+ categories = self .analyzer .get_developer_categories ()
281
+ self .assertDictEqual (categories , {"core" : 4 , "regular" : 1 , "casual" : 0 })
282
+
219
283
220
284
if __name__ == "__main__" :
221
285
unittest .main ()
0 commit comments