Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lprint modification #287

Merged
merged 6 commits into from
Nov 19, 2024
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- PyPI badge in `README.md`
- GitHub actions are limited to the `dev` and `master` branches
- `Python 3.13` added to `test.yml`
- `README.md` modified
## [6.3] - 2024-09-19
### Added
- `data` directory
Expand Down
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,15 +347,15 @@ Filename: test.txt

#### 1. lprint

This function prints a grid (`length` by `height`) of any given character.
This function prints a grid (`length` by `height`) of any given character in normal mode and raise `artError` in exception.
```pycon
>>> lprint(length=15, height=2, char="*")
***************
***************
```

* Note1: This feature has been added since `Version 6.4`
* Note2: The default values are `length=15`, `height=1`, `char='#'`
* Note1 : New in `Version 6.4`
* Note2 : The default values are `length=15`, `height=1`, `char='#'`

#### 2. line

Expand All @@ -365,8 +365,8 @@ This function returns a grid (`length` by `height`) of any given character as `s
'***************\n***************'
```

* Note1: This feature has been added since `Version 6.4`
* Note2: The default values are `length=15`, `height=1`, `char='#'`
* Note1 : New in `Version 6.4`
* Note2 : The default values are `length=15`, `height=1`, `char='#'`


### Decoration
Expand Down Expand Up @@ -743,7 +743,17 @@ _/ _ _ _/
<td align="center">text2art</td>
<td align="center">str</td>
<td align="center">raise artError</td>
</tr>
</tr>
<tr>
<td align="center">lprint</td>
<td align="center">None</td>
<td align="center">raise artError</td>
</tr>
<tr>
<td align="center">line</td>
<td align="center">str</td>
<td align="center">raise artError</td>
</tr>
<tr>
<td align="center">set_default</td>
<td align="center">None</td>
Expand Down
7 changes: 2 additions & 5 deletions art/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,8 @@ def lprint(length=15, height=1, char='#'):
:type char: str
:return: None
"""
try:
grid = line(length, height, char)
print(grid)
except artError as e:
print(str(e))
grid = line(length, height, char)
print(grid)


def line(length=15, height=1, char='#'):
Expand Down
12 changes: 11 additions & 1 deletion art/tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,17 @@
***************
***************
>>> lprint(length=0, height=1, char="#")
The 'length' must be an int higher than 0.
Traceback (most recent call last):
...
art.art.artError: The 'length' must be an int higher than 0.
>>> lprint(length=15, height='test', char="#")
Traceback (most recent call last):
...
art.art.artError: The 'height' must be an int higher than 0.
>>> lprint(length=15, height=2, char=4)
Traceback (most recent call last):
...
art.art.artError: The 'char' type must be str.
>>> line(length=10, height=1, char="#")
'##########'
>>> line(length=15, height=2, char="*")
Expand Down
Loading