Ordinary package to say if a time variable falls between two given times.
Project description
py-time-between
Ordinary package to say if a time variable falls between two given times.
Usage:
from datetime import time
from timebetween import is_time_between
def test_is_time_between():
t, s, e = time(0), time(0), time(0)
assert is_time_between(t, s, e)
t, s, e = time(0, 0, 0, 1), time(0), time(0, 0, 0, 2)
assert is_time_between(t, s, e)
t, s, e = time(0, 0, 0, 1), time(0, 0, 0, 1), time(0, 0, 0, 2)
assert is_time_between(t, s, e)
t, s, e = time(0, 0, 0, 2), time(0, 0, 0, 1), time(0, 0, 0, 2)
assert is_time_between(t, s, e)
t, s, e = time(0, 0, 1), time(23, 59, 59), time(0, 0, 2)
assert is_time_between(t, s, e)
t, s, e = time(12, 0, 0), time(23, 59, 59), time(0, 0, 0)
assert is_time_between(t, s, e)
t, s, e = time(23, 59, 57), time(23, 59, 59), time(23, 59, 57)
assert is_time_between(t, s, e)
t, s, e = time(23, 59, 58), time(23, 59, 59), time(23, 59, 57)
assert not is_time_between(t, s, e)
# Hey, did you see a uncovered test case?
# Please, open a PR.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py-time-between-0.1.0.tar.gz
(1.7 kB
view hashes)
Built Distribution
Close
Hashes for py_time_between-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4c44c0970c734d21ff608e3490b5dade90fbbd691dade8a627744ea6b63ce9c |
|
MD5 | 36bce97b35b63547f5f7c59fe5d75cbc |
|
BLAKE2b-256 | ccf8535b76e35af2a6ea0ff2430371c8e4c40fd2741832fba143fee729dd9fe6 |