Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion arrow/arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1855,7 +1855,7 @@ def _get_frames(cls, name: _T_FRAMES) -> Tuple[str, str, int]:
"""
if name in cls._ATTRS:
return name, f"{name}s", 1
elif name[-1] == "s" and name[:-1] in cls._ATTRS:
elif name.endswith("s") and name[:-1] in cls._ATTRS:
return name[:-1], name, 1
elif name in ["week", "weeks"]:
return "week", "weeks", 1
Expand Down
14 changes: 8 additions & 6 deletions tests/test_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1084,11 +1084,12 @@ def test_imaginary(self):
assert len(pacific_range) == len(set(pacific_range))
assert len(utc_range) == len(set(utc_range))

def test_unsupported(self):
with pytest.raises(ValueError):
@pytest.mark.parametrize("frame", ["abc", ""])
def test_unsupported(self, frame):
with pytest.raises(ValueError, match="not supported. Supported frames:"):
next(
arrow.Arrow.range(
"abc", datetime.now(timezone.utc), datetime.now(timezone.utc)
frame, datetime.now(timezone.utc), datetime.now(timezone.utc)
)
)

Expand Down Expand Up @@ -1631,9 +1632,10 @@ def test_exact(self):

@pytest.mark.usefixtures("time_2013_02_15")
class TestArrowSpan:
def test_span_attribute(self):
with pytest.raises(ValueError):
self.arrow.span("span")
@pytest.mark.parametrize("frame", ["span", ""])
def test_span_attribute(self, frame):
with pytest.raises(ValueError, match="not supported. Supported frames:"):
self.arrow.span(frame)

def test_span_year(self):
floor, ceil = self.arrow.span("year")
Expand Down
Loading