encommon 0.7.6__py3-none-any.whl → 0.8.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- encommon/config/__init__.py +4 -0
- encommon/config/common.py +18 -14
- encommon/config/config.py +8 -5
- encommon/config/files.py +13 -7
- encommon/config/logger.py +94 -88
- encommon/config/params.py +1 -1
- encommon/config/paths.py +16 -8
- encommon/config/test/test_common.py +27 -4
- encommon/config/test/test_config.py +48 -82
- encommon/config/test/test_files.py +58 -43
- encommon/config/test/test_logger.py +129 -82
- encommon/config/test/test_paths.py +70 -30
- encommon/conftest.py +52 -12
- encommon/crypts/__init__.py +2 -0
- encommon/crypts/crypts.py +3 -1
- encommon/crypts/hashes.py +2 -2
- encommon/crypts/test/test_crypts.py +50 -28
- encommon/crypts/test/test_hashes.py +20 -18
- encommon/times/__init__.py +2 -0
- encommon/times/common.py +99 -15
- encommon/times/duration.py +50 -36
- encommon/times/parse.py +13 -25
- encommon/times/test/test_common.py +47 -16
- encommon/times/test/test_duration.py +104 -79
- encommon/times/test/test_parse.py +53 -63
- encommon/times/test/test_timers.py +90 -36
- encommon/times/test/test_times.py +21 -30
- encommon/times/test/test_window.py +73 -21
- encommon/times/timers.py +91 -58
- encommon/times/times.py +36 -34
- encommon/times/window.py +4 -4
- encommon/types/dicts.py +10 -4
- encommon/types/empty.py +7 -2
- encommon/types/strings.py +10 -0
- encommon/types/test/test_dicts.py +5 -5
- encommon/types/test/test_empty.py +4 -1
- encommon/types/test/test_strings.py +1 -1
- encommon/utils/__init__.py +4 -0
- encommon/utils/common.py +51 -6
- encommon/utils/match.py +1 -0
- encommon/utils/paths.py +42 -23
- encommon/utils/sample.py +31 -27
- encommon/utils/stdout.py +28 -17
- encommon/utils/test/test_common.py +35 -0
- encommon/utils/test/test_paths.py +3 -2
- encommon/utils/test/test_sample.py +28 -12
- encommon/version.txt +1 -1
- {encommon-0.7.6.dist-info → encommon-0.8.0.dist-info}/METADATA +1 -1
- encommon-0.8.0.dist-info/RECORD +63 -0
- encommon-0.7.6.dist-info/RECORD +0 -62
- {encommon-0.7.6.dist-info → encommon-0.8.0.dist-info}/LICENSE +0 -0
- {encommon-0.7.6.dist-info → encommon-0.8.0.dist-info}/WHEEL +0 -0
- {encommon-0.7.6.dist-info → encommon-0.8.0.dist-info}/top_level.txt +0 -0
@@ -10,7 +10,6 @@ is permitted, for more information consult the project license file.
|
|
10
10
|
from datetime import timedelta
|
11
11
|
|
12
12
|
from pytest import mark
|
13
|
-
from pytest import raises
|
14
13
|
|
15
14
|
from ..common import utcdatetime
|
16
15
|
from ..parse import parse_time
|
@@ -25,85 +24,67 @@ def test_parse_time() -> None:
|
|
25
24
|
Perform various tests associated with relevant routines.
|
26
25
|
"""
|
27
26
|
|
28
|
-
|
27
|
+
dtime = utcdatetime()
|
29
28
|
delta = timedelta(seconds=1)
|
30
29
|
|
31
30
|
|
32
|
-
|
31
|
+
parsed = parse_time(
|
33
32
|
'1/1/1970 6:00am')
|
34
33
|
|
35
|
-
assert
|
36
|
-
assert
|
37
|
-
assert
|
38
|
-
assert
|
34
|
+
assert parsed.year == 1970
|
35
|
+
assert parsed.month == 1
|
36
|
+
assert parsed.day == 1
|
37
|
+
assert parsed.hour == 6
|
39
38
|
|
40
39
|
|
41
|
-
|
40
|
+
parsed = parse_time(
|
42
41
|
'12/31/1969 6:00pm',
|
43
42
|
tzname='US/Central')
|
44
43
|
|
45
|
-
assert
|
46
|
-
assert
|
47
|
-
assert
|
48
|
-
assert
|
44
|
+
assert parsed.year == 1970
|
45
|
+
assert parsed.month == 1
|
46
|
+
assert parsed.day == 1
|
47
|
+
assert parsed.hour == 0
|
49
48
|
|
50
49
|
|
51
|
-
|
52
|
-
assert
|
50
|
+
parsed = parse_time(0)
|
51
|
+
assert parsed.year == 1970
|
53
52
|
|
54
|
-
|
55
|
-
assert
|
53
|
+
parsed = parse_time('0')
|
54
|
+
assert parsed.year == 1970
|
56
55
|
|
57
56
|
|
58
|
-
|
57
|
+
parsed = parse_time('max')
|
59
58
|
|
60
|
-
assert
|
61
|
-
assert
|
62
|
-
assert
|
63
|
-
assert
|
59
|
+
assert parsed.year == 9999
|
60
|
+
assert parsed.month == 12
|
61
|
+
assert parsed.day == 31
|
62
|
+
assert parsed.hour == 23
|
64
63
|
|
65
|
-
|
64
|
+
parsed = parse_time('min')
|
66
65
|
|
67
|
-
assert
|
68
|
-
assert
|
69
|
-
assert
|
70
|
-
assert
|
66
|
+
assert parsed.year == 1
|
67
|
+
assert parsed.month == 1
|
68
|
+
assert parsed.day == 1
|
69
|
+
assert parsed.hour == 0
|
71
70
|
|
72
71
|
|
73
|
-
|
74
|
-
assert
|
72
|
+
parsed = parse_time('now')
|
73
|
+
assert parsed - dtime <= delta
|
75
74
|
|
76
|
-
|
77
|
-
assert
|
75
|
+
parsed = parse_time(None)
|
76
|
+
assert parsed - dtime <= delta
|
78
77
|
|
79
|
-
|
80
|
-
assert
|
78
|
+
parsed = parse_time('None')
|
79
|
+
assert parsed - dtime <= delta
|
81
80
|
|
82
81
|
|
83
|
-
|
84
|
-
assert
|
82
|
+
parsed = parse_time('+1y')
|
83
|
+
assert parsed - dtime > delta
|
85
84
|
|
86
85
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
def test_parse_time_raises() -> None:
|
92
|
-
"""
|
93
|
-
Perform various tests associated with relevant routines.
|
94
|
-
"""
|
95
|
-
|
96
|
-
|
97
|
-
with raises(ValueError) as reason:
|
98
|
-
parse_time(0, tzname='foo/bar')
|
99
|
-
|
100
|
-
assert str(reason.value) == 'tzname'
|
101
|
-
|
102
|
-
|
103
|
-
with raises(ValueError) as reason:
|
104
|
-
parse_time(parse_time) # type: ignore
|
105
|
-
|
106
|
-
assert str(reason.value) == 'source'
|
86
|
+
_parsed = parse_time(parsed)
|
87
|
+
assert _parsed == parsed
|
107
88
|
|
108
89
|
|
109
90
|
|
@@ -145,10 +126,11 @@ def test_shift_time(
|
|
145
126
|
"""
|
146
127
|
|
147
128
|
anchor = utcdatetime(1980, 1, 1)
|
129
|
+
dtime = utcdatetime(*expect)
|
148
130
|
|
149
131
|
parsed = shift_time(notate, anchor)
|
150
132
|
|
151
|
-
assert parsed ==
|
133
|
+
assert parsed == dtime
|
152
134
|
|
153
135
|
|
154
136
|
|
@@ -162,26 +144,32 @@ def test_string_time() -> None:
|
|
162
144
|
|
163
145
|
strings = [
|
164
146
|
'1980-01-01T00:00:00Z',
|
147
|
+
'1980-01-01T00:00:00 +0000',
|
165
148
|
'1980-01-01T00:00:00',
|
166
149
|
'1980-01-01 00:00:00 +0000',
|
167
150
|
'1980-01-01 00:00:00']
|
168
151
|
|
169
152
|
for string in strings:
|
170
|
-
|
153
|
+
|
154
|
+
parsed = string_time(string)
|
155
|
+
|
156
|
+
assert parsed == expect
|
171
157
|
|
172
158
|
|
173
159
|
parsed = string_time(
|
174
160
|
'1980_01_01',
|
175
|
-
formats=['%
|
161
|
+
formats=['%Y_%m_%d'])
|
176
162
|
|
177
163
|
assert parsed == expect
|
178
164
|
|
165
|
+
|
179
166
|
parsed = string_time(
|
180
167
|
'1980_01_01',
|
181
168
|
formats='%Y_%m_%d')
|
182
169
|
|
183
170
|
assert parsed == expect
|
184
171
|
|
172
|
+
|
185
173
|
parsed = string_time(
|
186
174
|
'1979-12-31 18:00:00',
|
187
175
|
tzname='US/Central')
|
@@ -196,13 +184,15 @@ def test_since_time() -> None:
|
|
196
184
|
"""
|
197
185
|
|
198
186
|
|
199
|
-
|
187
|
+
parsed = shift_time('-1s')
|
188
|
+
since = since_time(parsed)
|
200
189
|
|
201
|
-
assert
|
202
|
-
assert
|
190
|
+
assert since >= 1
|
191
|
+
assert since < 2
|
203
192
|
|
204
193
|
|
205
|
-
|
194
|
+
parsed = shift_time('+1s')
|
195
|
+
since = since_time(parsed)
|
206
196
|
|
207
|
-
assert
|
208
|
-
assert
|
197
|
+
assert since > 0
|
198
|
+
assert since < 2
|
@@ -10,110 +10,164 @@ is permitted, for more information consult the project license file.
|
|
10
10
|
from pathlib import Path
|
11
11
|
from time import sleep
|
12
12
|
|
13
|
+
from pytest import fixture
|
13
14
|
from pytest import raises
|
14
15
|
|
15
16
|
from ..timers import Timers
|
16
17
|
|
17
18
|
|
18
19
|
|
19
|
-
|
20
|
+
@fixture
|
21
|
+
def timers(
|
22
|
+
tmp_path: Path,
|
23
|
+
) -> Timers:
|
24
|
+
"""
|
25
|
+
Construct the instance for use in the downstream tests.
|
26
|
+
|
27
|
+
:param tmp_path: pytest object for temporal filesystem.
|
28
|
+
:returns: Newly constructed instance of related class.
|
29
|
+
"""
|
30
|
+
|
31
|
+
return Timers(
|
32
|
+
timers={'one': 1},
|
33
|
+
file=f'{tmp_path}/cache.db')
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
def test_Timers(
|
38
|
+
timers: Timers,
|
39
|
+
) -> None:
|
20
40
|
"""
|
21
41
|
Perform various tests associated with relevant routines.
|
42
|
+
|
43
|
+
:param timers: Primary class instance for timers object.
|
22
44
|
"""
|
23
45
|
|
24
|
-
timers = Timers({'one': 1})
|
25
46
|
|
26
47
|
attrs = list(timers.__dict__)
|
27
48
|
|
28
49
|
assert attrs == [
|
29
|
-
'
|
30
|
-
'
|
31
|
-
'
|
32
|
-
'
|
50
|
+
'_Timers__config',
|
51
|
+
'_Timers__sqlite',
|
52
|
+
'_Timers__file',
|
53
|
+
'_Timers__table',
|
54
|
+
'_Timers__cache']
|
55
|
+
|
56
|
+
|
57
|
+
assert repr(timers)[:22] == (
|
58
|
+
'<encommon.times.timers')
|
33
59
|
|
60
|
+
assert hash(timers) > 0
|
34
61
|
|
35
|
-
assert
|
36
|
-
'<encommon.times.timers
|
37
|
-
assert isinstance(hash(timers), int)
|
38
|
-
assert str(timers).startswith(
|
39
|
-
'<encommon.times.timers.Timers')
|
62
|
+
assert str(timers)[:22] == (
|
63
|
+
'<encommon.times.timers')
|
40
64
|
|
41
65
|
|
42
66
|
assert timers.timers == {'one': 1}
|
43
|
-
|
44
|
-
assert
|
45
|
-
|
67
|
+
|
68
|
+
assert timers.sqlite is not None
|
69
|
+
|
70
|
+
assert timers.file[-8:] == 'cache.db'
|
71
|
+
|
72
|
+
assert timers.table == 'timers'
|
73
|
+
|
74
|
+
assert list(timers.cache) == ['one']
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
def test_Timers_cover(
|
79
|
+
timers: Timers,
|
80
|
+
) -> None:
|
81
|
+
"""
|
82
|
+
Perform various tests associated with relevant routines.
|
83
|
+
|
84
|
+
:param timers: Primary class instance for timers object.
|
85
|
+
"""
|
46
86
|
|
47
87
|
|
48
88
|
assert not timers.ready('one')
|
89
|
+
|
49
90
|
sleep(1.1)
|
91
|
+
|
50
92
|
assert timers.ready('one')
|
51
93
|
|
52
94
|
|
53
95
|
timers.create('two', 2, 0)
|
54
96
|
|
55
97
|
assert timers.ready('two')
|
98
|
+
|
56
99
|
assert not timers.ready('two')
|
57
100
|
|
58
101
|
|
59
102
|
|
60
103
|
def test_Timers_cache(
|
61
|
-
|
104
|
+
timers: Timers,
|
62
105
|
) -> None:
|
63
106
|
"""
|
64
107
|
Perform various tests associated with relevant routines.
|
65
108
|
|
66
|
-
:param
|
109
|
+
:param timers: Primary class instance for timers object.
|
67
110
|
"""
|
68
111
|
|
69
|
-
cache_file = (
|
70
|
-
f'{tmp_path}/timers.db')
|
71
|
-
|
72
112
|
timers1 = Timers(
|
73
|
-
timers={'
|
74
|
-
|
113
|
+
timers={'uno': 1},
|
114
|
+
file=timers.file)
|
75
115
|
|
76
|
-
assert not timers1.ready('
|
116
|
+
assert not timers1.ready('uno')
|
77
117
|
|
78
118
|
sleep(0.75)
|
79
119
|
|
80
120
|
timers2 = Timers(
|
81
|
-
timers={'
|
82
|
-
|
121
|
+
timers={'uno': 1},
|
122
|
+
file=timers.file)
|
83
123
|
|
84
|
-
assert not timers1.ready('
|
85
|
-
assert not timers2.ready('
|
124
|
+
assert not timers1.ready('uno')
|
125
|
+
assert not timers2.ready('uno')
|
86
126
|
|
87
127
|
sleep(0.25)
|
88
128
|
|
89
129
|
timers2.load_cache()
|
90
130
|
|
91
|
-
assert timers1.ready('
|
92
|
-
assert timers2.ready('
|
131
|
+
assert timers1.ready('uno')
|
132
|
+
assert timers2.ready('uno')
|
93
133
|
|
94
134
|
|
95
135
|
|
96
|
-
def test_Timers_raises(
|
136
|
+
def test_Timers_raises(
|
137
|
+
timers: Timers,
|
138
|
+
) -> None:
|
97
139
|
"""
|
98
140
|
Perform various tests associated with relevant routines.
|
141
|
+
|
142
|
+
:param timers: Primary class instance for timers object.
|
99
143
|
"""
|
100
144
|
|
101
|
-
timers = Timers({'one': 1})
|
102
145
|
|
146
|
+
_raises = raises(ValueError)
|
103
147
|
|
104
|
-
with
|
148
|
+
with _raises as reason:
|
105
149
|
timers.ready('dne')
|
106
150
|
|
107
|
-
|
151
|
+
_reason = str(reason.value)
|
108
152
|
|
153
|
+
assert _reason == 'unique'
|
109
154
|
|
110
|
-
|
155
|
+
|
156
|
+
_raises = raises(ValueError)
|
157
|
+
|
158
|
+
with _raises as reason:
|
111
159
|
timers.update('dne')
|
112
160
|
|
113
|
-
|
161
|
+
_reason = str(reason.value)
|
162
|
+
|
163
|
+
assert _reason == 'unique'
|
114
164
|
|
115
165
|
|
116
|
-
|
166
|
+
_raises = raises(ValueError)
|
167
|
+
|
168
|
+
with _raises as reason:
|
117
169
|
timers.create('one', 1)
|
118
170
|
|
119
|
-
|
171
|
+
_reason = str(reason.value)
|
172
|
+
|
173
|
+
assert _reason == 'unique'
|
@@ -7,8 +7,6 @@ is permitted, for more information consult the project license file.
|
|
7
7
|
|
8
8
|
|
9
9
|
|
10
|
-
from pytest import raises
|
11
|
-
|
12
10
|
from ..common import STAMP_SIMPLE
|
13
11
|
from ..common import UNIXEPOCH
|
14
12
|
from ..common import UNIXHPOCH
|
@@ -22,21 +20,25 @@ def test_Times() -> None:
|
|
22
20
|
Perform various tests associated with relevant routines.
|
23
21
|
"""
|
24
22
|
|
25
|
-
times = Times(
|
23
|
+
times = Times(
|
24
|
+
UNIXEPOCH,
|
25
|
+
format=STAMP_SIMPLE)
|
26
|
+
|
26
27
|
|
27
28
|
attrs = list(times.__dict__)
|
28
29
|
|
29
30
|
assert attrs == [
|
30
|
-
'_Times__source'
|
31
|
+
'_Times__source',
|
32
|
+
'_Times__hashed']
|
33
|
+
|
31
34
|
|
35
|
+
assert repr(times)[:23] == (
|
36
|
+
"Times('1970-01-01T00:00")
|
32
37
|
|
33
|
-
assert
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
assert str(times) == (
|
38
|
-
'1970-01-01T00:00:00'
|
39
|
-
'.000000+0000')
|
38
|
+
assert hash(times) > 0
|
39
|
+
|
40
|
+
assert str(times)[:23] == (
|
41
|
+
'1970-01-01T00:00:00.000')
|
40
42
|
|
41
43
|
|
42
44
|
assert int(times) == 0
|
@@ -58,37 +60,26 @@ def test_Times() -> None:
|
|
58
60
|
assert times.source.year == 1970
|
59
61
|
|
60
62
|
assert times.epoch == 0.0
|
63
|
+
|
61
64
|
assert times.mpoch == 0.0
|
65
|
+
|
62
66
|
assert times.simple == UNIXEPOCH
|
67
|
+
|
63
68
|
assert times.subsec == UNIXMPOCH
|
69
|
+
|
64
70
|
assert times.human == UNIXHPOCH
|
71
|
+
|
65
72
|
assert times.elapsed >= 1672531200
|
73
|
+
|
66
74
|
assert times.since >= 1672531200
|
67
75
|
|
68
76
|
assert times.before == (
|
69
77
|
'1969-12-31T23:59:59.999999Z')
|
78
|
+
|
70
79
|
assert times.after == (
|
71
80
|
'1970-01-01T00:00:00.000001Z')
|
72
81
|
|
73
|
-
|
74
|
-
tzname='US/Central')
|
75
|
-
|
76
|
-
assert stamp[:4] == '1969'
|
77
|
-
assert stamp[11:][:2] == '18'
|
78
|
-
|
82
|
+
assert times.stamp() == UNIXMPOCH
|
79
83
|
|
80
84
|
times = times.shift('+1y')
|
81
|
-
|
82
85
|
assert times == '1971-01-01'
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
def test_Times_raises() -> None:
|
87
|
-
"""
|
88
|
-
Perform various tests associated with relevant routines.
|
89
|
-
"""
|
90
|
-
|
91
|
-
with raises(ValueError) as reason:
|
92
|
-
Times(0).stamp(tzname='foo')
|
93
|
-
|
94
|
-
assert str(reason.value) == 'tzname'
|
@@ -7,21 +7,43 @@ is permitted, for more information consult the project license file.
|
|
7
7
|
|
8
8
|
|
9
9
|
|
10
|
+
from typing import TYPE_CHECKING
|
11
|
+
|
12
|
+
from pytest import fixture
|
10
13
|
from pytest import mark
|
11
14
|
|
12
|
-
from ..common import PARSABLE
|
13
15
|
from ..window import Window
|
14
16
|
from ..window import window_croniter
|
15
17
|
from ..window import window_interval
|
16
18
|
|
19
|
+
if TYPE_CHECKING:
|
20
|
+
from ..common import PARSABLE
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
@fixture
|
25
|
+
def window() -> Window:
|
26
|
+
"""
|
27
|
+
Construct the instance for use in the downstream tests.
|
28
|
+
|
29
|
+
:returns: Newly constructed instance of related class.
|
30
|
+
"""
|
31
|
+
|
32
|
+
return Window(
|
33
|
+
schedule='* * * * *',
|
34
|
+
start=330, stop=630)
|
17
35
|
|
18
36
|
|
19
|
-
|
37
|
+
|
38
|
+
def test_Window(
|
39
|
+
window: Window,
|
40
|
+
) -> None:
|
20
41
|
"""
|
21
42
|
Perform various tests associated with relevant routines.
|
43
|
+
|
44
|
+
:param window: Primary class instance for window object.
|
22
45
|
"""
|
23
46
|
|
24
|
-
window = Window('* * * * *', 330, 630)
|
25
47
|
|
26
48
|
attrs = list(window.__dict__)
|
27
49
|
|
@@ -36,23 +58,52 @@ def test_Window() -> None:
|
|
36
58
|
'_Window__walked']
|
37
59
|
|
38
60
|
|
39
|
-
assert repr(window)
|
40
|
-
'<encommon.times.window
|
41
|
-
|
42
|
-
assert
|
43
|
-
|
61
|
+
assert repr(window)[:22] == (
|
62
|
+
'<encommon.times.window')
|
63
|
+
|
64
|
+
assert hash(window) > 0
|
65
|
+
|
66
|
+
assert str(window)[:22] == (
|
67
|
+
'<encommon.times.window')
|
44
68
|
|
45
69
|
|
46
70
|
assert window.schedule == '* * * * *'
|
71
|
+
|
47
72
|
assert window.start == '1970-01-01T00:05:30Z'
|
73
|
+
|
48
74
|
assert window.stop == '1970-01-01T00:10:30Z'
|
75
|
+
|
49
76
|
assert window.anchor == window.start
|
77
|
+
|
50
78
|
assert window.delay == 0.0
|
79
|
+
|
51
80
|
assert window.last == '1970-01-01T00:05:00Z'
|
81
|
+
|
52
82
|
assert window.next == '1970-01-01T00:06:00Z'
|
83
|
+
|
53
84
|
assert window.walked is False
|
54
85
|
|
55
86
|
|
87
|
+
|
88
|
+
def test_Window_cover(
|
89
|
+
window: Window,
|
90
|
+
) -> None:
|
91
|
+
"""
|
92
|
+
Perform various tests associated with relevant routines.
|
93
|
+
|
94
|
+
:param window: Primary class instance for window object.
|
95
|
+
"""
|
96
|
+
|
97
|
+
|
98
|
+
window = Window(
|
99
|
+
schedule='* * * * *',
|
100
|
+
start=window.start,
|
101
|
+
stop=window.stop)
|
102
|
+
|
103
|
+
assert window.last == '1970-01-01T00:05:00Z'
|
104
|
+
assert window.next == '1970-01-01T00:06:00Z'
|
105
|
+
assert window.walked is False
|
106
|
+
|
56
107
|
for count in range(100):
|
57
108
|
if window.walk() is False:
|
58
109
|
break
|
@@ -66,15 +117,13 @@ def test_Window() -> None:
|
|
66
117
|
assert window.walked is True
|
67
118
|
|
68
119
|
|
69
|
-
window = Window(
|
120
|
+
window = Window(
|
121
|
+
schedule={'minutes': 1},
|
122
|
+
start=window.start,
|
123
|
+
stop=window.stop)
|
70
124
|
|
71
|
-
assert window.
|
72
|
-
assert window.
|
73
|
-
assert window.stop == '1970-01-01T00:10:00Z'
|
74
|
-
assert window.anchor == window.start
|
75
|
-
assert window.delay == 0.0
|
76
|
-
assert window.last == '1970-01-01T00:04:00Z'
|
77
|
-
assert window.next == '1970-01-01T00:05:00Z'
|
125
|
+
assert window.last == '1970-01-01T00:04:30Z'
|
126
|
+
assert window.next == '1970-01-01T00:05:30Z'
|
78
127
|
assert window.walked is False
|
79
128
|
|
80
129
|
for count in range(100):
|
@@ -85,12 +134,15 @@ def test_Window() -> None:
|
|
85
134
|
assert count == 5
|
86
135
|
assert not window.walk()
|
87
136
|
|
88
|
-
assert window.last == '1970-01-01T00:10:
|
89
|
-
assert window.next == '1970-01-01T00:10:
|
137
|
+
assert window.last == '1970-01-01T00:10:30Z'
|
138
|
+
assert window.next == '1970-01-01T00:10:30Z'
|
90
139
|
assert window.walked is True
|
91
140
|
|
92
141
|
|
93
|
-
window = Window(
|
142
|
+
window = Window(
|
143
|
+
schedule='* * * * *',
|
144
|
+
start='+5m', stop='+10m')
|
145
|
+
|
94
146
|
assert not window.walk(False)
|
95
147
|
|
96
148
|
|
@@ -110,7 +162,7 @@ def test_Window() -> None:
|
|
110
162
|
('0 * * * *', 3661, False, (3600, 7200))])
|
111
163
|
def test_window_croniter(
|
112
164
|
schedule: str,
|
113
|
-
anchor: PARSABLE,
|
165
|
+
anchor: 'PARSABLE',
|
114
166
|
backward: bool,
|
115
167
|
expect: tuple[int, int],
|
116
168
|
) -> None:
|
@@ -146,7 +198,7 @@ def test_window_croniter(
|
|
146
198
|
({'hours': 1}, 3661, False, (3661, 7261))])
|
147
199
|
def test_window_interval(
|
148
200
|
schedule: dict[str, int],
|
149
|
-
anchor: PARSABLE,
|
201
|
+
anchor: 'PARSABLE',
|
150
202
|
backward: bool,
|
151
203
|
expect: tuple[int, int],
|
152
204
|
) -> None:
|