Skip to content

Commit

Permalink
lprint modification (#287)
Browse files Browse the repository at this point in the history
* fix : lprint function modified

* fix : tests updated

* doc : README.md lprint section updated

* doc : README.md functions table updated

* doc : README.md lprint/line section updated

* doc : CHANGELOG.md updated
  • Loading branch information
sepandhaghighi authored Nov 19, 2024
1 parent 5adf215 commit 3aacd2c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 12 deletions.
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

0 comments on commit 3aacd2c

Please sign in to comment.