tests/test_main_helpers.py
raw| 1 | from __future__ import annotations |
| 2 | |
| 3 | import pytest |
| 4 | |
| 5 | from build.__main__ import _natural_language_list |
| 6 | |
| 7 | |
| 8 | def test_natural_language_list() -> None: |
| 9 | assert _natural_language_list(['one']) == 'one' |
| 10 | assert _natural_language_list(['one', 'two']) == 'one and two' |
| 11 | assert _natural_language_list(['one', 'two', 'three']) == 'one, two and three' |
| 12 | with pytest.raises(IndexError, match='no elements'): |
| 13 | _natural_language_list([]) |