Skip to content

Commit

Permalink
Add: (refs #183) pytest> 'test_prev_time_index_lim' for 'get_prev_tim…
Browse files Browse the repository at this point in the history
…e_index'
  • Loading branch information
Cj-bc committed Sep 10, 2018
1 parent 8fc1108 commit 4590aa2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/test_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,16 @@ def test_prev_time_index_ooa(client):
get_prev_time_index(mod_time(start_of_first_index, res))
with pytest.raises(OutOfAcceptingHoursError):
get_prev_time_index(mod_time(end_of_last_index, res))


def test_prev_time_index_lim(client):
with client.application.app_context():
res = datetime.timedelta.resolution
en_margin = client.application.config['TIMEPOINT_END_MARGIN']
ends = [mod_time(tp[1], en_margin) for tp
in client.application.config['TIMEPOINTS']]
for i in range(len(ends)-1):
idx_l = get_prev_time_index(mod_time(ends[i], res))
assert i == idx_l
idx_r = get_prev_time_index(mod_time(ends[i+1], -res))
assert i == idx_r

0 comments on commit 4590aa2

Please sign in to comment.