summaryrefslogtreecommitdiff
path: root/cmd2/utils.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-12-09 16:34:07 -0500
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-12-09 16:34:07 -0500
commit5ffed1387ddc4e5725f9c6b5b632a611eca1e3ca (patch)
treea9092d195e5099c62e526adfbf46acc77ef3b84b /cmd2/utils.py
parent6f16e671971a9fac4edfda9c0117ceaeb5e6487e (diff)
downloadcmd2-git-5ffed1387ddc4e5725f9c6b5b632a611eca1e3ca.tar.gz
Added more text alignment unit tests
Diffstat (limited to 'cmd2/utils.py')
-rw-r--r--cmd2/utils.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/cmd2/utils.py b/cmd2/utils.py
index d7c9ff19..4235db7d 100644
--- a/cmd2/utils.py
+++ b/cmd2/utils.py
@@ -737,6 +737,8 @@ def ljustify_text(text: str, *, fill_char: str = ' ', width: Optional[int] = Non
:param tab_width: any tabs in the text will be replaced with this many spaces. if fill_char is a tab, then it will
be converted to a space.
:return: left-justified text
+ :raises: TypeError if fill_char is more than one character
+ ValueError if text or fill_char contains an unprintable character
"""
return align_text(text, fill_char=fill_char, width=width,
tab_width=tab_width, alignment=TextAlignment.LEFT)
@@ -754,6 +756,8 @@ def center_text(text: str, *, fill_char: str = ' ', width: Optional[int] = None,
:param tab_width: any tabs in the text will be replaced with this many spaces. if fill_char is a tab, then it will
be converted to a space.
:return: centered text
+ :raises: TypeError if fill_char is more than one character
+ ValueError if text or fill_char contains an unprintable character
"""
return align_text(text, fill_char=fill_char, width=width,
tab_width=tab_width, alignment=TextAlignment.CENTER)
@@ -771,6 +775,8 @@ def rjustify_text(text: str, *, fill_char: str = ' ', width: Optional[int] = Non
:param tab_width: any tabs in the text will be replaced with this many spaces. if fill_char is a tab, then it will
be converted to a space.
:return: right-justified text
+ :raises: TypeError if fill_char is more than one character
+ ValueError if text or fill_char contains an unprintable character
"""
return align_text(text, fill_char=fill_char, width=width,
tab_width=tab_width, alignment=TextAlignment.RIGHT)