Skip to content

Commit 6c51b42

Browse files
author
brentru
committed
pass time
1 parent 759bb66 commit 6c51b42

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

tests/test_datetime.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,9 @@
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
1113
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-
2014
# CircuitPython subset implementation
2115
sys.path.append("..")
2216
from adafruit_datetime import datetime as cpy_datetime
@@ -26,6 +20,15 @@
2620
from adafruit_datetime import time
2721
from adafruit_datetime import timezone
2822

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+
2932
# TZinfo test
3033
class FixedOffset(tzinfo):
3134
def __init__(self, offset, name, dstoffset=42):
@@ -268,7 +271,7 @@ def strftime(self, format_spec):
268271
@unittest.skip("ctime not implemented")
269272
def test_more_ctime(self):
270273
# Test fields that TestDate doesn't touch.
271-
import time
274+
import time as cpython_time
272275

273276
t = self.theclass(2002, 3, 2, 18, 3, 5, 123)
274277
self.assertEqual(t.ctime(), "Sat Mar 2 18:03:05 2002")
@@ -280,7 +283,7 @@ def test_more_ctime(self):
280283

281284
# So test a case where that difference doesn't matter.
282285
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())))
284287

285288
def test_tz_independent_comparing(self):
286289
dt1 = self.theclass(2002, 3, 1, 9, 0, 0)
@@ -537,7 +540,6 @@ def test_timestamp_naive(self):
537540
self.assertEqual(self.theclass.fromtimestamp(t.timestamp()), t)
538541

539542
# Timestamp may raise an overflow error on some platforms
540-
# XXX: Do we care to support the first and last year?
541543
for t in [self.theclass(2, 1, 1), self.theclass(9998, 12, 12)]:
542544
try:
543545
s = t.timestamp()

tests/test_time.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
# SPDX-License-Identifier: Python-2.0
1010
# Implements a subset of https://github.com/python/cpython/blob/master/Lib/test/datetimetester.py
1111
# 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,
13-
# CPython standard implementation
14-
from datetime import time as cpython_time
15-
import unittest
12+
# pylint:disable = invalid-name, no-member, cell-var-from-loop, unused-argument, no-self-use, too-few-public-methods, consider-using-enumerate, undefined-variable
1613
# CircuitPython subset implementation
1714
import sys
18-
1915
sys.path.append("..")
2016
from adafruit_datetime import time as cpy_time
17+
# CPython standard implementation
18+
from datetime import time as cpython_time
19+
import unittest
20+
2121

2222
# An arbitrary collection of objects of non-datetime types, for testing
2323
# mixed-type comparisons.

0 commit comments

Comments
 (0)