From 759bb66e2deafc35821a2d94b6b930fc6f69d7e1 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 17 Mar 2021 11:38:13 -0400 Subject: [PATCH 1/8] disable linting errors on _time --- tests/test_time.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_time.py b/tests/test_time.py index e5820e4..b1e39ad 100644 --- a/tests/test_time.py +++ b/tests/test_time.py @@ -8,11 +8,11 @@ # SPDX-FileCopyrightText: 2021 Brent Rubell for Adafruit Industries # SPDX-License-Identifier: Python-2.0 # Implements a subset of https://github.com/python/cpython/blob/master/Lib/test/datetimetester.py -import unittest - +# NOTE: This test is based off CPython and therefore linting is disabled within this file. +# pylint:disable = invalid-name, no-member, cell-var-from-loop, unused-argument, no-self-use, too-few-public-methods, # CPython standard implementation from datetime import time as cpython_time - +import unittest # CircuitPython subset implementation import sys From 6c51b42e33e0dfaffe16539c79eaf7e8cad42607 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 17 Mar 2021 11:43:21 -0400 Subject: [PATCH 2/8] pass time --- tests/test_datetime.py | 24 +++++++++++++----------- tests/test_time.py | 10 +++++----- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/tests/test_datetime.py b/tests/test_datetime.py index 140bd84..f3ac3c0 100644 --- a/tests/test_datetime.py +++ b/tests/test_datetime.py @@ -8,15 +8,9 @@ # SPDX-FileCopyrightText: 2021 Brent Rubell for Adafruit Industries # SPDX-License-Identifier: Python-2.0 # Implements a subset of https://github.com/python/cpython/blob/master/Lib/test/datetimetester.py +# NOTE: This test is based off CPython and therefore linting is disabled within this file. +# 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 import sys -import unittest -from test import support -from test_date import TestDate - -# CPython standard implementation -from datetime import datetime as cpython_datetime -from datetime import MINYEAR, MAXYEAR - # CircuitPython subset implementation sys.path.append("..") from adafruit_datetime import datetime as cpy_datetime @@ -26,6 +20,15 @@ from adafruit_datetime import time from adafruit_datetime import timezone +import unittest +from test import support +from test_date import TestDate + +# CPython standard implementation +from datetime import datetime as cpython_datetime +from datetime import MINYEAR, MAXYEAR + + # TZinfo test class FixedOffset(tzinfo): def __init__(self, offset, name, dstoffset=42): @@ -268,7 +271,7 @@ def strftime(self, format_spec): @unittest.skip("ctime not implemented") def test_more_ctime(self): # Test fields that TestDate doesn't touch. - import time + import time as cpython_time t = self.theclass(2002, 3, 2, 18, 3, 5, 123) self.assertEqual(t.ctime(), "Sat Mar 2 18:03:05 2002") @@ -280,7 +283,7 @@ def test_more_ctime(self): # So test a case where that difference doesn't matter. t = self.theclass(2002, 3, 22, 18, 3, 5, 123) - self.assertEqual(t.ctime(), time.ctime(time.mktime(t.timetuple()))) + self.assertEqual(t.ctime(), cpython_time.ctime(cpython_time.mktime(t.timetuple()))) def test_tz_independent_comparing(self): dt1 = self.theclass(2002, 3, 1, 9, 0, 0) @@ -537,7 +540,6 @@ def test_timestamp_naive(self): self.assertEqual(self.theclass.fromtimestamp(t.timestamp()), t) # Timestamp may raise an overflow error on some platforms - # XXX: Do we care to support the first and last year? for t in [self.theclass(2, 1, 1), self.theclass(9998, 12, 12)]: try: s = t.timestamp() diff --git a/tests/test_time.py b/tests/test_time.py index b1e39ad..04f9bc8 100644 --- a/tests/test_time.py +++ b/tests/test_time.py @@ -9,15 +9,15 @@ # SPDX-License-Identifier: Python-2.0 # Implements a subset of https://github.com/python/cpython/blob/master/Lib/test/datetimetester.py # NOTE: This test is based off CPython and therefore linting is disabled within this file. -# pylint:disable = invalid-name, no-member, cell-var-from-loop, unused-argument, no-self-use, too-few-public-methods, -# CPython standard implementation -from datetime import time as cpython_time -import unittest +# pylint:disable = invalid-name, no-member, cell-var-from-loop, unused-argument, no-self-use, too-few-public-methods, consider-using-enumerate, undefined-variable # CircuitPython subset implementation import sys - sys.path.append("..") from adafruit_datetime import time as cpy_time +# CPython standard implementation +from datetime import time as cpython_time +import unittest + # An arbitrary collection of objects of non-datetime types, for testing # mixed-type comparisons. From d62b418b27b49b30435084544468b91be4128ebe Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 17 Mar 2021 11:55:00 -0400 Subject: [PATCH 3/8] date --- tests/test_datetime.py | 7 +++++-- tests/test_time.py | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/test_datetime.py b/tests/test_datetime.py index f3ac3c0..02b3e0c 100644 --- a/tests/test_datetime.py +++ b/tests/test_datetime.py @@ -9,8 +9,9 @@ # SPDX-License-Identifier: Python-2.0 # Implements a subset of https://github.com/python/cpython/blob/master/Lib/test/datetimetester.py # NOTE: This test is based off CPython and therefore linting is disabled within this file. -# 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 +# 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 import sys + # CircuitPython subset implementation sys.path.append("..") from adafruit_datetime import datetime as cpy_datetime @@ -283,7 +284,9 @@ def test_more_ctime(self): # So test a case where that difference doesn't matter. t = self.theclass(2002, 3, 22, 18, 3, 5, 123) - self.assertEqual(t.ctime(), cpython_time.ctime(cpython_time.mktime(t.timetuple()))) + self.assertEqual( + t.ctime(), cpython_time.ctime(cpython_time.mktime(t.timetuple())) + ) def test_tz_independent_comparing(self): dt1 = self.theclass(2002, 3, 1, 9, 0, 0) diff --git a/tests/test_time.py b/tests/test_time.py index 04f9bc8..51595ef 100644 --- a/tests/test_time.py +++ b/tests/test_time.py @@ -12,8 +12,10 @@ # pylint:disable = invalid-name, no-member, cell-var-from-loop, unused-argument, no-self-use, too-few-public-methods, consider-using-enumerate, undefined-variable # CircuitPython subset implementation import sys + sys.path.append("..") from adafruit_datetime import time as cpy_time + # CPython standard implementation from datetime import time as cpython_time import unittest From 85df52cadf2f58846ab526e3711fc8cce8c882c8 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 17 Mar 2021 12:00:11 -0400 Subject: [PATCH 4/8] pass datetime --- tests/test_datetime.py | 2 +- tests/test_time.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_datetime.py b/tests/test_datetime.py index 02b3e0c..f0b2225 100644 --- a/tests/test_datetime.py +++ b/tests/test_datetime.py @@ -9,7 +9,7 @@ # SPDX-License-Identifier: Python-2.0 # Implements a subset of https://github.com/python/cpython/blob/master/Lib/test/datetimetester.py # NOTE: This test is based off CPython and therefore linting is disabled within this file. -# 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 +# 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 import sys # CircuitPython subset implementation diff --git a/tests/test_time.py b/tests/test_time.py index 51595ef..76d87db 100644 --- a/tests/test_time.py +++ b/tests/test_time.py @@ -9,7 +9,7 @@ # SPDX-License-Identifier: Python-2.0 # Implements a subset of https://github.com/python/cpython/blob/master/Lib/test/datetimetester.py # NOTE: This test is based off CPython and therefore linting is disabled within this file. -# pylint:disable = invalid-name, no-member, cell-var-from-loop, unused-argument, no-self-use, too-few-public-methods, consider-using-enumerate, undefined-variable +# pylint:disable=invalid-name, no-member, cell-var-from-loop, unused-argument, no-self-use, too-few-public-methods, consider-using-enumerate, undefined-variable # CircuitPython subset implementation import sys From 3cf6b40960e94586bed99fc9a14ab2264338a65c Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 17 Mar 2021 12:01:58 -0400 Subject: [PATCH 5/8] add date --- tests/test_date.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_date.py b/tests/test_date.py index 2e5e09c..e404d5f 100644 --- a/tests/test_date.py +++ b/tests/test_date.py @@ -8,6 +8,8 @@ # SPDX-FileCopyrightText: 2021 Brent Rubell for Adafruit Industries # SPDX-License-Identifier: Python-2.0 # Implements a subset of https://github.com/python/cpython/blob/master/Lib/test/datetimetester.py +# NOTE: This test is based off CPython and therefore linting is disabled within this file. +# pylint:disable=invalid-name, no-member, wrong-import-position, undefined-variable, no-self-use, cell-var-from-loop, misplaced-comparison-constant, too-many-public-methods import sys import unittest From c03b79c522267ce965be4a3ec7aca009de4a3fc2 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 17 Mar 2021 12:05:03 -0400 Subject: [PATCH 6/8] fixes for time/dt --- tests/test_datetime.py | 2 +- tests/test_time.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_datetime.py b/tests/test_datetime.py index f0b2225..5ec72e0 100644 --- a/tests/test_datetime.py +++ b/tests/test_datetime.py @@ -9,7 +9,7 @@ # SPDX-License-Identifier: Python-2.0 # Implements a subset of https://github.com/python/cpython/blob/master/Lib/test/datetimetester.py # NOTE: This test is based off CPython and therefore linting is disabled within this file. -# 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 +# 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 import sys # CircuitPython subset implementation diff --git a/tests/test_time.py b/tests/test_time.py index 76d87db..ff9d944 100644 --- a/tests/test_time.py +++ b/tests/test_time.py @@ -9,7 +9,7 @@ # SPDX-License-Identifier: Python-2.0 # Implements a subset of https://github.com/python/cpython/blob/master/Lib/test/datetimetester.py # NOTE: This test is based off CPython and therefore linting is disabled within this file. -# pylint:disable=invalid-name, no-member, cell-var-from-loop, unused-argument, no-self-use, too-few-public-methods, consider-using-enumerate, undefined-variable +# pylint:disable=invalid-name, no-member, cell-var-from-loop, unused-argument, no-self-use, too-few-public-methods, consider-using-enumerate, undefined-variable, wrong-import-order, wrong-import-position # CircuitPython subset implementation import sys From 2ec786a81661c60387e9940ec74b2f95e88c4bcb Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 17 Mar 2021 12:09:57 -0400 Subject: [PATCH 7/8] lint testdate --- tests/test_date.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_date.py b/tests/test_date.py index e404d5f..a332c87 100644 --- a/tests/test_date.py +++ b/tests/test_date.py @@ -9,7 +9,7 @@ # SPDX-License-Identifier: Python-2.0 # Implements a subset of https://github.com/python/cpython/blob/master/Lib/test/datetimetester.py # NOTE: This test is based off CPython and therefore linting is disabled within this file. -# pylint:disable=invalid-name, no-member, wrong-import-position, undefined-variable, no-self-use, cell-var-from-loop, misplaced-comparison-constant, too-many-public-methods +# pylint:disable=invalid-name, no-member, wrong-import-position, undefined-variable, no-self-use, cell-var-from-loop, misplaced-comparison-constant, too-many-public-methods, fixme, import-outside-toplevel, unused-argument import sys import unittest From 09b35f5308bea99cbaca3bfd76b444760412f7b6 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 17 Mar 2021 12:16:21 -0400 Subject: [PATCH 8/8] last issue --- tests/test_date.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_date.py b/tests/test_date.py index a332c87..297c71e 100644 --- a/tests/test_date.py +++ b/tests/test_date.py @@ -9,7 +9,7 @@ # SPDX-License-Identifier: Python-2.0 # Implements a subset of https://github.com/python/cpython/blob/master/Lib/test/datetimetester.py # NOTE: This test is based off CPython and therefore linting is disabled within this file. -# pylint:disable=invalid-name, no-member, wrong-import-position, undefined-variable, no-self-use, cell-var-from-loop, misplaced-comparison-constant, too-many-public-methods, fixme, import-outside-toplevel, unused-argument +# pylint:disable=invalid-name, no-member, wrong-import-position, undefined-variable, no-self-use, cell-var-from-loop, misplaced-comparison-constant, too-many-public-methods, fixme, import-outside-toplevel, unused-argument, too-few-public-methods import sys import unittest