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, 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
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
14
20
15
# CircuitPython subset implementation
21
16
sys .path .append (".." )
26
21
from adafruit_datetime import time
27
22
from adafruit_datetime import timezone
28
23
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
+
29
33
# TZinfo test
30
34
class FixedOffset (tzinfo ):
31
35
def __init__ (self , offset , name , dstoffset = 42 ):
@@ -268,7 +272,7 @@ def strftime(self, format_spec):
268
272
@unittest .skip ("ctime not implemented" )
269
273
def test_more_ctime (self ):
270
274
# Test fields that TestDate doesn't touch.
271
- import time
275
+ import time as cpython_time
272
276
273
277
t = self .theclass (2002 , 3 , 2 , 18 , 3 , 5 , 123 )
274
278
self .assertEqual (t .ctime (), "Sat Mar 2 18:03:05 2002" )
@@ -280,7 +284,9 @@ def test_more_ctime(self):
280
284
281
285
# So test a case where that difference doesn't matter.
282
286
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
+ )
284
290
285
291
def test_tz_independent_comparing (self ):
286
292
dt1 = self .theclass (2002 , 3 , 1 , 9 , 0 , 0 )
@@ -537,7 +543,6 @@ def test_timestamp_naive(self):
537
543
self .assertEqual (self .theclass .fromtimestamp (t .timestamp ()), t )
538
544
539
545
# Timestamp may raise an overflow error on some platforms
540
- # XXX: Do we care to support the first and last year?
541
546
for t in [self .theclass (2 , 1 , 1 ), self .theclass (9998 , 12 , 12 )]:
542
547
try :
543
548
s = t .timestamp ()
0 commit comments