-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Rename packages from `template` to `templatelib`. - Bugfix: Convert string values to float.
- Loading branch information
1 parent
073953e
commit d39d069
Showing
9 changed files
with
53 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
# 2024.02.23 | ||
# Changelog | ||
|
||
- Features: Create this template with a sum function | ||
## v0.1.1 2024.03.14 | ||
|
||
- Rename packages from `template` to `templatelib`. | ||
- Bugfix: Convert string values to float. | ||
|
||
## v0.1.0 2024.02.23 | ||
|
||
- Features: Create this template with a sum function. | ||
- Bugfix: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi" | |
|
||
|
||
[project] | ||
name = "template" | ||
name = "templatelib" | ||
authors = [{ name = "Felipe Maza", email = "[email protected]" }] | ||
maintainers = [{ name = "Felipe Maza", email = "[email protected]" }] | ||
readme = "README.md" | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
""" Template """ | ||
|
||
__version__ = "0.1.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import math | ||
|
||
|
||
class Template(object): | ||
def sum(self, value1, value2) -> float: | ||
""" | ||
Sum two float values. | ||
Parameters: | ||
- value1: The first value to be summed. It can be an int, float, or string. | ||
- value2: The second value to be summed. It can be an int, float, or string. | ||
Returns: | ||
The sum of the two values. | ||
""" | ||
if type(value1) == str: | ||
value1 = float(value1) | ||
if type(value2) == str: | ||
value2 = float(value2) | ||
return math.fsum([value1, value2]) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import pytest | ||
from templatelib.template import Template | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"value1, value2, expected", | ||
[ | ||
(1, 1, 2), | ||
(2, 2, 4), | ||
(3, 2.0, 5), | ||
(4, 2, 6), | ||
(5, 7, 12), | ||
(3, 4, 7), | ||
("3", "4", 7), | ||
(3.0, 4.0, 7), | ||
], | ||
) | ||
def test_sum(value1, value2, expected): | ||
template = Template() | ||
assert template.sum(value1, value2) == expected |