88# SPDX-FileCopyrightText: 2021 Brent Rubell for Adafruit Industries
99# SPDX-License-Identifier: Python-2.0
1010# Implements a subset of https://github.com/python/cpython/blob/master/Lib/test/datetimetester.py
11+ # NOTE: This test is based off CPython and therefore linting is disabled within this file.
12+ # pylint:disable=invalid-name, no-member, cell-var-from-loop, unused-argument, no-self-use, too-few-public-methods, raise-missing-from, too-many-statements, too-many-lines, undefined-variable, eval-used, import-outside-toplevel, redefined-outer-name, too-many-locals, reimported, protected-access, wrong-import-position, consider-using-enumerate, wrong-import-order, redefined-builtin, too-many-public-methods
1113import sys
12- import unittest
13- from test import support
14- from test_date import TestDate
15-
16- # CPython standard implementation
17- from datetime import datetime as cpython_datetime
18- from datetime import MINYEAR , MAXYEAR
1914
2015# CircuitPython subset implementation
2116sys .path .append (".." )
2621from adafruit_datetime import time
2722from adafruit_datetime import timezone
2823
24+ import unittest
25+ from test import support
26+ from test_date import TestDate
27+
28+ # CPython standard implementation
29+ from datetime import datetime as cpython_datetime
30+ from datetime import MINYEAR , MAXYEAR
31+
32+
2933# TZinfo test
3034class FixedOffset (tzinfo ):
3135 def __init__ (self , offset , name , dstoffset = 42 ):
@@ -268,7 +272,7 @@ def strftime(self, format_spec):
268272 @unittest .skip ("ctime not implemented" )
269273 def test_more_ctime (self ):
270274 # Test fields that TestDate doesn't touch.
271- import time
275+ import time as cpython_time
272276
273277 t = self .theclass (2002 , 3 , 2 , 18 , 3 , 5 , 123 )
274278 self .assertEqual (t .ctime (), "Sat Mar 2 18:03:05 2002" )
@@ -280,7 +284,9 @@ def test_more_ctime(self):
280284
281285 # So test a case where that difference doesn't matter.
282286 t = self .theclass (2002 , 3 , 22 , 18 , 3 , 5 , 123 )
283- self .assertEqual (t .ctime (), time .ctime (time .mktime (t .timetuple ())))
287+ self .assertEqual (
288+ t .ctime (), cpython_time .ctime (cpython_time .mktime (t .timetuple ()))
289+ )
284290
285291 def test_tz_independent_comparing (self ):
286292 dt1 = self .theclass (2002 , 3 , 1 , 9 , 0 , 0 )
@@ -537,7 +543,6 @@ def test_timestamp_naive(self):
537543 self .assertEqual (self .theclass .fromtimestamp (t .timestamp ()), t )
538544
539545 # Timestamp may raise an overflow error on some platforms
540- # XXX: Do we care to support the first and last year?
541546 for t in [self .theclass (2 , 1 , 1 ), self .theclass (9998 , 12 , 12 )]:
542547 try :
543548 s = t .timestamp ()
0 commit comments