Skip to content

Commit

Permalink
Use underscore for new API
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Oct 5, 2024
1 parent 234839e commit 8a2ce25
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/humanize/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from humanize.filesize import naturalsize
from humanize.i18n import activate, deactivate, decimal_separator, thousands_separator
from humanize.lists import naturallist
from humanize.lists import natural_list
from humanize.number import (
apnumber,
clamp,
Expand Down Expand Up @@ -39,7 +39,7 @@
"naturaldate",
"naturalday",
"naturaldelta",
"naturallist",
"natural_list",
"naturalsize",
"naturaltime",
"ordinal",
Expand Down
10 changes: 5 additions & 5 deletions src/humanize/lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@

from typing import Any

__all__ = ["naturallist"]
__all__ = ["natural_list"]


def naturallist(items: list[Any]) -> str:
def natural_list(items: list[Any]) -> str:
"""Natural list.
Convert a list of items into a human-readable string with commas and 'and'.
Examples:
>>> naturallist(["one", "two", "three"])
>>> natural_list(["one", "two", "three"])
'one, two and three'
>>> naturallist(["one", "two"])
>>> natural_list(["one", "two"])
'one and two'
>>> naturallist(["one"])
>>> natural_list(["one"])
'one'
Args:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
([[1, "two"]], "1 and two"),
],
)
def test_naturallist(
def test_natural_list(
test_args: list[str] | list[int] | list[str | int], expected: str
) -> None:
assert humanize.naturallist(*test_args) == expected
assert humanize.natural_list(*test_args) == expected

0 comments on commit 8a2ce25

Please sign in to comment.