@@ -22,13 +22,26 @@ def setUp(self):
2222 """
2323 self .contributor = ContributorStats (
2424 "zkoppert" ,
25- False ,
2625 "https://avatars.githubusercontent.com/u/29484535?v=4" ,
2726 1261 ,
2827 "commit_url5" ,
2928 "" ,
3029 )
3130
31+ def test_init_new_contributor_true (self ):
32+ """
33+ Test that new_contributor=True is preserved by __init__.
34+ """
35+ contributor = ContributorStats (
36+ "new_user" ,
37+ avatar_url = "https://example.com/avatar.png" ,
38+ contribution_count = 1 ,
39+ commit_url = "commit_url_new" ,
40+ sponsor_info = "" ,
41+ new_contributor = True ,
42+ )
43+ self .assertTrue (contributor .new_contributor )
44+
3245 def test_init (self ):
3346 """
3447 Test the __init__ method of the ContributorStats class.
@@ -49,11 +62,11 @@ def test_repr(self):
4962 """Test the __repr__ method includes key fields."""
5063 expected = (
5164 "contributor_stats(username=zkoppert, "
52- "new_contributor=False, "
5365 "avatar_url=https://avatars.githubusercontent.com/u/29484535?v=4, "
5466 "contribution_count=1261, "
5567 "commit_url=commit_url5, "
56- "sponsor_info=)"
68+ "sponsor_info=, "
69+ "new_contributor=False)"
5770 )
5871 self .assertEqual (repr (self .contributor ), expected )
5972
@@ -63,23 +76,20 @@ def test_merge_contributors(self):
6376 """
6477 contributor1 = ContributorStats (
6578 "user1" ,
66- False ,
6779 "https://avatars.githubusercontent.com/u/29484535?v=4" ,
6880 100 ,
6981 "commit_url1" ,
7082 "" ,
7183 )
7284 contributor2 = ContributorStats (
7385 "user2" ,
74- False ,
7586 "https://avatars.githubusercontent.com/u/29484535?v=4" ,
7687 200 ,
7788 "commit_url2" ,
7889 "" ,
7990 )
8091 contributor3 = ContributorStats (
8192 "user1" ,
82- False ,
8393 "https://avatars.githubusercontent.com/u/29484535?v=4" ,
8494 150 ,
8595 "commit_url3" ,
@@ -95,15 +105,13 @@ def test_merge_contributors(self):
95105 expected_result = [
96106 ContributorStats (
97107 "user1" ,
98- False ,
99108 "https://avatars.githubusercontent.com/u/29484535?v=4" ,
100109 250 ,
101110 "commit_url1, commit_url3" ,
102111 "" ,
103112 ),
104113 ContributorStats (
105114 "user2" ,
106- False ,
107115 "https://avatars.githubusercontent.com/u/29484535?v=4" ,
108116 200 ,
109117 "commit_url2" ,
@@ -123,15 +131,13 @@ def test_is_new_contributor_true(self):
123131 returning_contributors = [
124132 ContributorStats (
125133 username = "user1" ,
126- new_contributor = False ,
127134 avatar_url = "https://avatars.githubusercontent.com/u/" ,
128135 contribution_count = 100 ,
129136 commit_url = "url1" ,
130137 sponsor_info = "" ,
131138 ),
132139 ContributorStats (
133140 username = "user2" ,
134- new_contributor = False ,
135141 avatar_url = "https://avatars.githubusercontent.com/u/" ,
136142 contribution_count = 200 ,
137143 commit_url = "url2" ,
@@ -151,15 +157,13 @@ def test_is_new_contributor_false(self):
151157 returning_contributors = [
152158 ContributorStats (
153159 username = "user1" ,
154- new_contributor = False ,
155160 avatar_url = "https://avatars.githubusercontent.com/u/" ,
156161 contribution_count = 100 ,
157162 commit_url = "url1" ,
158163 sponsor_info = "" ,
159164 ),
160165 ContributorStats (
161166 username = "user2" ,
162- new_contributor = False ,
163167 avatar_url = "https://avatars.githubusercontent.com/u/" ,
164168 contribution_count = 200 ,
165169 commit_url = "url2" ,
@@ -189,7 +193,6 @@ def test_fetch_sponsor_info(self, mock_post):
189193 returning_contributors = [
190194 ContributorStats (
191195 username = user ,
192- new_contributor = False ,
193196 avatar_url = "https://avatars.githubusercontent.com/u/" ,
194197 contribution_count = 100 ,
195198 commit_url = "url1" ,
@@ -237,7 +240,6 @@ def test_fetch_sponsor_info_raises_on_error(self, mock_post):
237240 contributors = [
238241 ContributorStats (
239242 username = "user1" ,
240- new_contributor = False ,
241243 avatar_url = "https://avatars.githubusercontent.com/u/" ,
242244 contribution_count = 100 ,
243245 commit_url = "url1" ,
0 commit comments