diff --git a/src/humanize/__init__.py b/src/humanize/__init__.py index 72c2b9c..224c483 100644 --- a/src/humanize/__init__.py +++ b/src/humanize/__init__.py @@ -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, @@ -39,7 +39,7 @@ "naturaldate", "naturalday", "naturaldelta", - "naturallist", + "natural_list", "naturalsize", "naturaltime", "ordinal", diff --git a/src/humanize/lists.py b/src/humanize/lists.py index 81217c9..1573be8 100644 --- a/src/humanize/lists.py +++ b/src/humanize/lists.py @@ -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: diff --git a/tests/test_lists.py b/tests/test_lists.py index d710449..a39d344 100644 --- a/tests/test_lists.py +++ b/tests/test_lists.py @@ -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