py-time-between 
Ordinary package to say if a time variable falls between two given times.
Motivation: I was working in a test to a job opening, and I needed it, but I did not want google this. I know that exists a lot of code like this.
Usage:
is_time_between(testing_time, start_time_inclusive, end_time_inclusive)
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)
t, s, e = time(22), time(22), time(5, 59, 59)
assert is_time_between(t, s, e)
# Hey, did you see a uncovered test case?
# Please, open a PR.
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.2.tar.gz
(1.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py-time-between-0.1.2.tar.gz.
File metadata
- Download URL: py-time-between-0.1.2.tar.gz
- Upload date:
- Size: 1.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23c2fc4dcae350a6b35d8d1adae2351a1277844837ded3287dc004df2c5fa708
|
|
| MD5 |
50936cd906a4c542349a564cd25c7aeb
|
|
| BLAKE2b-256 |
41a1e6b661a4b9c236d2bbabf0b874fe9f7c704687fed108c9b0af0e19495cb3
|
File details
Details for the file py_time_between-0.1.2-py3-none-any.whl.
File metadata
- Download URL: py_time_between-0.1.2-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
073533cb24c793e7fce4b522ceeddea411ac50323b113ff8f3afa1934a8a6700
|
|
| MD5 |
8522e74090bb3104011462870b10b0d9
|
|
| BLAKE2b-256 |
5dde5aa4af0b05e3ee9a718138ad5faa1672b75a6685170e094045fdbb9e9ef1
|