1- from datetime import date
21
32import pytest
43
@@ -83,14 +82,17 @@ def test_commit_type_commit_type_by_week():
8382 analyzer .process (commit )
8483 result = analyzer .result ()
8584
86- assert len (result .commit_type_by_week ) == 11
87- assert result .timeseries ["2025-W18" ] == {"unknown" : 1 , "style" : 1 , "test" : 1 }
88- assert result .timeseries ["2025-W14" ] == {"unknown" : 2 , "fix" : 1 }
89- assert result .timeseries ["2025-W05" ] == {"chore" : 1 , "refactor" : 1 , "fix" : 1 }
90- assert result .timeseries ["2025-W04" ] == {"unknown" : 2 }
91- assert result .timeseries ["2025-W22" ] == {"unknown" : 1 }
92- assert result .timeseries ["2024-W36" ] == {"unknown" : 4 , "fix" : 1 , "refactor" : 1 }
93- assert result .timeseries ["2024-W01" ] == {"unknown" : 4 }
85+ assert result .commit_type_by_week ["2024-W01" ] == {"unknown" : 4 }
86+ assert result .commit_type_by_week ["2024-W36" ] == {"fix" : 1 , "refactor" : 1 , "unknown" : 4 }
87+ assert result .commit_type_by_week ["2025-W01" ] == {"unknown" : 3 }
88+ assert result .commit_type_by_week ["2025-W05" ] == {"chore" : 1 , "fix" : 1 , "refactor" : 1 }
89+ assert result .commit_type_by_week ["2025-W14" ] == {"fix" : 1 , "unknown" : 2 }
90+ assert result .commit_type_by_week ["2025-W18" ] == {"style" : 1 , "test" : 1 , "unknown" : 1 }
91+ assert result .commit_type_by_week ["2025-W22" ] == {"fix" : 1 }
92+ assert result .commit_type_by_week ["2025-W23" ] == {"chore" : 1 , "unknown" : 4 }
93+ assert result .commit_type_by_week ["2025-W25" ] == {"chore" : 1 , "fix" : 1 , "test" : 1 , "unknown" : 3 }
94+ assert result .commit_type_by_week ["2025-W26" ] == {"refactor" : 2 , "style" : 1 , "unknown" : 2 }
95+ assert result .commit_type_by_week ["2025-W27" ] == {"refactor" : 1 }
9496
9597
9698def test_commit_type_total_counter ():
@@ -101,8 +103,7 @@ def test_commit_type_total_counter():
101103 analyzer .process (commit )
102104 result = analyzer .result ()
103105
104- assert sum (result .total_counter .values ()) == 40
105- assert result .total_counter == {"unknown" : 23 , "refactor" : 5 , "fix" : 5 , "chore" : 3 , "style" : 2 , "test" : 2 }
106+ assert result .commit_type_counter == {"unknown" : 23 , "refactor" : 5 , "fix" : 5 , "chore" : 3 , "style" : 2 , "test" : 2 }
106107
107108
108109def test_commit_type_author_total_counter ():
@@ -113,5 +114,8 @@ def test_commit_type_author_total_counter():
113114 analyzer .process (commit )
114115 result = analyzer .result ()
115116
116- assert result .author_total_counter .keys () == {"Alice" , "Bob" , "Carol" , "Dave" , "Oscar" }
117- assert sum (sum (v .values ()) for v in result .author_total_counter .values ()) == 40
117+ assert result .author_commit_type_counter ["Alice" ] == {"chore" : 1 , "fix" : 1 , "style" : 2 , "unknown" : 7 }
118+ assert result .author_commit_type_counter ["Bob" ] == {"refactor" : 5 , "unknown" : 1 }
119+ assert result .author_commit_type_counter ["Carol" ] == {"chore" : 1 , "unknown" : 3 }
120+ assert result .author_commit_type_counter ["Dave" ] == {"test" : 2 , "unknown" : 9 }
121+ assert result .author_commit_type_counter ["Oscar" ] == {"chore" : 1 , "fix" : 4 , "unknown" : 3 }
0 commit comments