From 47bd4ed490804970f14d25ec2ae8cc45dbf7c8dd Mon Sep 17 00:00:00 2001 From: Edwin Eefting Date: Sun, 17 May 2020 14:49:08 +0200 Subject: [PATCH] use gmtime instead of localtime --- requirements.txt | 1 + run_tests | 4 ++ test_thinner.py | 130 ++++++++++++++++++++++++----------------------- 3 files changed, 71 insertions(+), 64 deletions(-) diff --git a/requirements.txt b/requirements.txt index f168c06..de4fcc3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ colorama argparse coverage +python-coveralls diff --git a/run_tests b/run_tests index b8dbb4f..aa00670 100755 --- a/run_tests +++ b/run_tests @@ -21,4 +21,8 @@ EXIT=$? echo coverage report +#this does automatic travis CI/https://coveralls.io/ intergration: +echo "Submitting to coveralls.io:" +coveralls + exit $EXIT diff --git a/test_thinner.py b/test_thinner.py index c9da816..49e28d0 100644 --- a/test_thinner.py +++ b/test_thinner.py @@ -7,7 +7,7 @@ class Thing: def __str__(self): # age=now-self.timestamp - struct=time.localtime(self.timestamp) + struct=time.gmtime(self.timestamp) return("{}".format(time.strftime("%Y-%m-%d %H:%M:%S",struct))) @@ -18,37 +18,38 @@ class TestThinner(unittest.TestCase): return super().setUp() def test_incremental(self): + ok=['2023-01-01 10:09:50', + '2024-01-01 20:06:35', + '2025-01-01 09:59:44', + '2026-01-01 18:06:41', + '2026-03-08 02:27:07', + '2026-04-07 02:29:04', + '2026-05-07 18:39:31', + '2026-06-06 06:06:14', + '2026-07-06 03:53:12', + '2026-08-05 06:23:43', + '2026-09-04 21:13:46', + '2026-10-04 00:50:48', + '2026-11-03 01:52:55', + '2026-12-03 15:04:25', + '2027-01-01 09:02:16', + '2027-01-02 09:59:16', + '2027-01-28 09:54:49', + '2027-02-01 08:59:47', + '2027-02-04 03:24:33', + '2027-02-11 01:51:49', + '2027-02-18 04:09:25', + '2027-02-19 14:21:39', + '2027-02-20 13:41:38', + '2027-02-21 07:33:50', + '2027-02-22 07:39:18', + '2027-02-23 07:52:18', + '2027-02-24 02:16:31', + '2027-02-24 02:17:08', + '2027-02-24 05:26:13', + '2027-02-24 12:56:41'] + - ok=['2023-01-01 11:09:50', - '2024-01-01 21:06:35', - '2025-01-01 10:59:44', - '2026-01-01 19:06:41', - '2026-03-08 03:27:07', - '2026-04-07 04:29:04', - '2026-05-07 20:39:31', - '2026-06-06 08:06:14', - '2026-07-06 05:53:12', - '2026-08-05 08:23:43', - '2026-09-04 23:13:46', - '2026-10-04 02:50:48', - '2026-11-03 02:52:55', - '2026-12-03 16:04:25', - '2027-01-01 10:02:16', - '2027-01-02 10:59:16', - '2027-01-28 10:54:49', - '2027-02-01 09:59:47', - '2027-02-04 04:24:33', - '2027-02-11 02:51:49', - '2027-02-18 05:09:25', - '2027-02-19 15:21:39', - '2027-02-20 14:41:38', - '2027-02-21 08:33:50', - '2027-02-22 08:39:18', - '2027-02-23 08:52:18', - '2027-02-24 03:16:31', - '2027-02-24 03:17:08', - '2027-02-24 06:26:13', - '2027-02-24 13:56:41'] #some arbitrary date now=1589229252 @@ -81,39 +82,40 @@ class TestThinner(unittest.TestCase): def test_full(self): - ok=['2022-02-24 16:54:37', - '2023-01-01 11:09:50', - '2024-01-01 21:06:35', - '2025-01-01 10:59:44', - '2026-01-01 19:06:41', - '2026-03-02 00:23:58', - '2026-03-08 03:27:07', - '2026-04-07 04:29:04', - '2026-05-07 20:39:31', - '2026-06-06 08:06:14', - '2026-07-06 05:53:12', - '2026-08-05 08:23:43', - '2026-09-04 23:13:46', - '2026-10-04 02:50:48', - '2026-11-03 02:52:55', - '2026-12-03 16:04:25', - '2027-01-01 10:02:16', - '2027-01-02 10:59:16', - '2027-01-25 21:00:35', - '2027-01-28 10:54:49', - '2027-02-01 09:59:47', - '2027-02-04 04:24:33', - '2027-02-11 02:51:49', - '2027-02-18 05:09:25', - '2027-02-19 15:21:39', - '2027-02-20 14:41:38', - '2027-02-21 08:33:50', - '2027-02-22 08:39:18', - '2027-02-23 08:52:18', - '2027-02-24 03:16:31', - '2027-02-24 03:17:08', - '2027-02-24 06:26:13', - '2027-02-24 13:56:41'] + ok=['2022-02-24 15:54:37', + '2023-01-01 10:09:50', + '2024-01-01 20:06:35', + '2025-01-01 09:59:44', + '2026-01-01 18:06:41', + '2026-03-01 23:23:58', + '2026-03-08 02:27:07', + '2026-04-07 02:29:04', + '2026-05-07 18:39:31', + '2026-06-06 06:06:14', + '2026-07-06 03:53:12', + '2026-08-05 06:23:43', + '2026-09-04 21:13:46', + '2026-10-04 00:50:48', + '2026-11-03 01:52:55', + '2026-12-03 15:04:25', + '2027-01-01 09:02:16', + '2027-01-02 09:59:16', + '2027-01-25 20:00:35', + '2027-01-28 09:54:49', + '2027-02-01 08:59:47', + '2027-02-04 03:24:33', + '2027-02-11 01:51:49', + '2027-02-18 04:09:25', + '2027-02-19 14:21:39', + '2027-02-20 13:41:38', + '2027-02-21 07:33:50', + '2027-02-22 07:39:18', + '2027-02-23 07:52:18', + '2027-02-24 02:16:31', + '2027-02-24 02:17:08', + '2027-02-24 05:26:13', + '2027-02-24 12:56:41'] + #some arbitrary date