Skip to content

Commit

Permalink
Added test that exposes bug in span_range
Browse files Browse the repository at this point in the history
  • Loading branch information
rkendra committed Dec 5, 2024
1 parent 1d70d00 commit 68634d5
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/test_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,28 @@ def test_month(self):
(arrow.Arrow(2013, 4, 1), arrow.Arrow(2013, 4, 30, 23, 59, 59, 999999)),
]

def test_month_end(self):
result = list(
arrow.Arrow.span_range(
"month", datetime(2013, 1, 31), datetime(2014, 1, 31), exact=True
)
)

assert result == [
(arrow.Arrow(2013, 1, 31), arrow.Arrow(2013, 2, 27, 23, 59, 59, 999999)),
(arrow.Arrow(2013, 2, 28), arrow.Arrow(2013, 3, 30, 23, 59, 59, 999999)),
(arrow.Arrow(2013, 3, 31), arrow.Arrow(2013, 4, 29, 23, 59, 59, 999999)),
(arrow.Arrow(2013, 4, 30), arrow.Arrow(2013, 5, 30, 23, 59, 59, 999999)),
(arrow.Arrow(2013, 5, 31), arrow.Arrow(2013, 6, 29, 23, 59, 59, 999999)),
(arrow.Arrow(2013, 6, 30), arrow.Arrow(2013, 7, 30, 23, 59, 59, 999999)),
(arrow.Arrow(2013, 7, 31), arrow.Arrow(2013, 8, 30, 23, 59, 59, 999999)),
(arrow.Arrow(2013, 8, 31), arrow.Arrow(2013, 9, 29, 23, 59, 59, 999999)),
(arrow.Arrow(2013, 9, 30), arrow.Arrow(2013, 10, 30, 23, 59, 59, 999999)),
(arrow.Arrow(2013, 10, 31), arrow.Arrow(2013, 11, 29, 23, 59, 59, 999999)),
(arrow.Arrow(2013, 11, 30), arrow.Arrow(2013, 12, 30, 23, 59, 59, 999999)),
(arrow.Arrow(2013, 12, 31), arrow.Arrow(2014, 1, 30, 23, 59, 59, 999999)),
]

def test_week(self):
result = list(
arrow.Arrow.span_range("week", datetime(2013, 2, 2), datetime(2013, 2, 28))
Expand Down

0 comments on commit 68634d5

Please sign in to comment.