@@ -43,7 +43,8 @@ def expect_date(
43
43
) -> Iterator [int | None ]:
44
44
sde , expect = request .param
45
45
with monkeypatch .context () as m :
46
- m .setattr (time , 'localtime' , lambda * a : LOCALTIME_2009 )
46
+ lt_orig = time .localtime
47
+ m .setattr (time , 'localtime' , lambda * a : lt_orig (* a ) if a else LOCALTIME_2009 )
47
48
if sde :
48
49
m .setenv ('SOURCE_DATE_EPOCH' , sde )
49
50
else :
@@ -129,7 +130,6 @@ def test_correct_year_placeholder(expect_date: int | None) -> None:
129
130
cfg = Config ({'copyright' : copyright_date }, {})
130
131
assert cfg .copyright == copyright_date
131
132
evaluate_copyright_placeholders (None , cfg ) # type: ignore[arg-type]
132
- correct_copyright_year (None , cfg ) # type: ignore[arg-type]
133
133
if expect_date and expect_date <= LOCALTIME_2009 .tm_year :
134
134
assert cfg .copyright == f'2006-{ expect_date } , Alice'
135
135
else :
@@ -203,11 +203,12 @@ def test_correct_year_multi_line_all_formats_placeholder(
203
203
# other format codes are left as-is
204
204
'2006-%y, Eve' ,
205
205
'%Y-%m-%d %H:%M:S %z, Francis' ,
206
+ # non-ascii range patterns are supported
207
+ '2000–%Y Guinevere' ,
206
208
)
207
209
cfg = Config ({'copyright' : copyright_dates }, {})
208
210
assert cfg .copyright == copyright_dates
209
211
evaluate_copyright_placeholders (None , cfg ) # type: ignore[arg-type]
210
- correct_copyright_year (None , cfg ) # type: ignore[arg-type]
211
212
if expect_date and expect_date <= LOCALTIME_2009 .tm_year :
212
213
assert cfg .copyright == (
213
214
f'{ expect_date } ' ,
@@ -217,7 +218,8 @@ def test_correct_year_multi_line_all_formats_placeholder(
217
218
f'2006-{ expect_date } Charlie' ,
218
219
f'2006-{ expect_date } , David' ,
219
220
'2006-%y, Eve' ,
220
- '2009-%m-%d %H:%M:S %z, Francis' ,
221
+ f'{ expect_date } -%m-%d %H:%M:S %z, Francis' ,
222
+ f'2000–{ expect_date } Guinevere' ,
221
223
)
222
224
else :
223
225
assert cfg .copyright == (
@@ -229,6 +231,7 @@ def test_correct_year_multi_line_all_formats_placeholder(
229
231
'2006-2009, David' ,
230
232
'2006-%y, Eve' ,
231
233
'2009-%m-%d %H:%M:S %z, Francis' ,
234
+ '2000–2009 Guinevere' ,
232
235
)
233
236
234
237
0 commit comments