Skip to content

Commit

Permalink
Merge pull request #1 from Suspir0n/develop
Browse files Browse the repository at this point in the history
finish creation library in python
  • Loading branch information
Suspir0n committed May 2, 2021
2 parents eaf0062 + 22fde71 commit d34561e
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 17 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,7 @@ dmypy.json
cython_debug/

# VS Code
.vscode/
.vscode/

# my files
settings.py
17 changes: 17 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
MIT License
Copyright (c) 2018 Evandro Silva
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "ctext"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "ctext", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
19 changes: 19 additions & 0 deletions ctext/center.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
def to_center(text, space, object=str()):
"""
This function is reponsible for centralizing the text. accepted at least two vestments.
:param text: receive any text, only string.
:param space: receive any value, only numbers.
:param object: receive any object, ex: - . = ~ < > _ | between others.
:return: The text centralized.
"""
try:
if object == '':
receive = f'{text:^{space}}'
else:
receive = f'{text:{object}^{space}}'
except ValueError as err:
return f'information value invalid, {err}'
except TypeError as err:
return f'The type value invalid, {err}'
else:
return receive
16 changes: 0 additions & 16 deletions main.py

This file was deleted.

2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pytest==6.2.3
twine==3.4.1
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[metadata]
description-file=README.md
18 changes: 18 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from setuptools import setup
from settings import NAME, VERSION, DESCRIPTION, LINCENSE, PACKAGES, AUTHOR, INSTALL_REQUIRES, SETUP_REQUIRES, TESTS_REQUIRES, TESTS_SUITE, AUTHOR_EMAIL, DOWNLOAD_URL, URL

setup(
name=NAME,
packages=PACKAGES,
version=VERSION,
description=DESCRIPTION,
author=AUTHOR,
license=LINCENSE,
install_requires=INSTALL_REQUIRES,
setup_requires=SETUP_REQUIRES,
tests_requires=TESTS_REQUIRES,
tests_suite=TESTS_SUITE,
author_email=AUTHOR_EMAIL,
url=URL,
download_url=DOWNLOAD_URL,
)
16 changes: 16 additions & 0 deletions tests/test_center.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from ctext.center import to_center

def test_to_center_happy_way():
receive_valid_one = to_center('Olá Mundo', 20)
receive_valid_two = to_center('Olá Mundo', '20')
receive_valid_three = to_center('Olá Mundo', 20, '=')
assert receive_valid_one
assert receive_valid_two
assert receive_valid_three


def test_to_center_happ_say():
receive_invalid = to_center('Olá Mundo', 'a')
assert receive_invalid


0 comments on commit d34561e

Please sign in to comment.