8
8
# SPDX-FileCopyrightText: 2021 Brent Rubell for Adafruit Industries
9
9
# SPDX-License-Identifier: Python-2.0
10
10
# 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
11
13
import 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
19
-
20
14
# CircuitPython subset implementation
21
15
sys .path .append (".." )
22
16
from adafruit_datetime import datetime as cpy_datetime
26
20
from adafruit_datetime import time
27
21
from adafruit_datetime import timezone
28
22
23
+ import unittest
24
+ from test import support
25
+ from test_date import TestDate
26
+
27
+ # CPython standard implementation
28
+ from datetime import datetime as cpython_datetime
29
+ from datetime import MINYEAR , MAXYEAR
30
+
31
+
29
32
# TZinfo test
30
33
class FixedOffset (tzinfo ):
31
34
def __init__ (self , offset , name , dstoffset = 42 ):
@@ -268,7 +271,7 @@ def strftime(self, format_spec):
268
271
@unittest .skip ("ctime not implemented" )
269
272
def test_more_ctime (self ):
270
273
# Test fields that TestDate doesn't touch.
271
- import time
274
+ import time as cpython_time
272
275
273
276
t = self .theclass (2002 , 3 , 2 , 18 , 3 , 5 , 123 )
274
277
self .assertEqual (t .ctime (), "Sat Mar 2 18:03:05 2002" )
@@ -280,7 +283,7 @@ def test_more_ctime(self):
280
283
281
284
# So test a case where that difference doesn't matter.
282
285
t = self .theclass (2002 , 3 , 22 , 18 , 3 , 5 , 123 )
283
- self .assertEqual (t .ctime (), time .ctime (time .mktime (t .timetuple ())))
286
+ self .assertEqual (t .ctime (), cpython_time .ctime (cpython_time .mktime (t .timetuple ())))
284
287
285
288
def test_tz_independent_comparing (self ):
286
289
dt1 = self .theclass (2002 , 3 , 1 , 9 , 0 , 0 )
@@ -537,7 +540,6 @@ def test_timestamp_naive(self):
537
540
self .assertEqual (self .theclass .fromtimestamp (t .timestamp ()), t )
538
541
539
542
# Timestamp may raise an overflow error on some platforms
540
- # XXX: Do we care to support the first and last year?
541
543
for t in [self .theclass (2 , 1 , 1 ), self .theclass (9998 , 12 , 12 )]:
542
544
try :
543
545
s = t .timestamp ()
0 commit comments