diff options
| author | Max Nanis | 2026-03-06 16:49:46 -0500 |
|---|---|---|
| committer | Max Nanis | 2026-03-06 16:49:46 -0500 |
| commit | 91d040211a4ed6e4157896256a762d3854777b5e (patch) | |
| tree | cd95922ea4257dc8d3f4e4cbe8534474709a20dc /tests/incite/test_interval_idx.py | |
| download | generalresearch-91d040211a4ed6e4157896256a762d3854777b5e.tar.gz generalresearch-91d040211a4ed6e4157896256a762d3854777b5e.zip | |
Initial commitv3.3.4
Diffstat (limited to 'tests/incite/test_interval_idx.py')
| -rw-r--r-- | tests/incite/test_interval_idx.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/incite/test_interval_idx.py b/tests/incite/test_interval_idx.py new file mode 100644 index 0000000..ea2bced --- /dev/null +++ b/tests/incite/test_interval_idx.py @@ -0,0 +1,23 @@ +import pandas as pd +from datetime import datetime, timezone, timedelta + + +class TestIntervalIndex: + + def test_init(self): + start = datetime(year=2000, month=1, day=1) + end = datetime(year=2000, month=1, day=10) + + iv_r: pd.IntervalIndex = pd.interval_range( + start=start, end=end, freq="1d", closed="left" + ) + assert isinstance(iv_r, pd.IntervalIndex) + assert len(iv_r.to_list()) == 9 + + # If the offset is longer than the end - start it will not + # error. It will simply have 0 rows. + iv_r: pd.IntervalIndex = pd.interval_range( + start=start, end=end, freq="30d", closed="left" + ) + assert isinstance(iv_r, pd.IntervalIndex) + assert len(iv_r.to_list()) == 0 |
