mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix DTZ00{0-4} (Do not use naive datetime objects)
This commit is contained in:
@@ -170,11 +170,6 @@ ignore = [
|
|||||||
"D",
|
"D",
|
||||||
# flake8-django
|
# flake8-django
|
||||||
"DJ", # Django is not used in Sphinx
|
"DJ", # Django is not used in Sphinx
|
||||||
# flake8-datetimez
|
|
||||||
"DTZ001", # do not use `datetime.datetime()` without `tzinfo` argument
|
|
||||||
"DTZ004", # do not use `datetime.datetime.utcfromtimestamp()`
|
|
||||||
"DTZ005", # do not use `datetime.datetime.now()` without `tz` argument
|
|
||||||
"DTZ006", # do not use `datetime.datetime.fromtimestamp()` without `tz` argument
|
|
||||||
# flake8-errmsg
|
# flake8-errmsg
|
||||||
"EM101", # exception must not use a string literal, assign to variable first
|
"EM101", # exception must not use a string literal, assign to variable first
|
||||||
"EM102", # exception must not use an f-string literal, assign to variable first
|
"EM102", # exception must not use an f-string literal, assign to variable first
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ def test_format_date():
|
|||||||
assert i18n.format_date(format, date=date, language='en') == format
|
assert i18n.format_date(format, date=date, language='en') == format
|
||||||
|
|
||||||
format = '%B %d, %Y, %H:%M:%S %I %p'
|
format = '%B %d, %Y, %H:%M:%S %I %p'
|
||||||
datet = datetime.datetime(2016, 2, 7, 5, 11, 17, 0)
|
datet = datetime.datetime(2016, 2, 7, 5, 11, 17, 0) # NoQA: DTZ001
|
||||||
assert i18n.format_date(format, date=datet, language='en') == 'February 07, 2016, 05:11:17 05 AM'
|
assert i18n.format_date(format, date=datet, language='en') == 'February 07, 2016, 05:11:17 05 AM'
|
||||||
|
|
||||||
format = '%B %-d, %Y, %-H:%-M:%-S %-I %p'
|
format = '%B %-d, %Y, %-H:%-M:%-S %-I %p'
|
||||||
|
|||||||
Reference in New Issue
Block a user