Skip to content

Commit

Permalink
v0.1.1 2024.03.14
Browse files Browse the repository at this point in the history
- Rename packages from `template` to `templatelib`.
- Bugfix: Convert string values to float.
  • Loading branch information
felipem775 committed Mar 14, 2024
1 parent 073953e commit d39d069
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 22 deletions.
11 changes: 9 additions & 2 deletions CHANGELOG.md
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: ...
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"


[project]
name = "template"
name = "templatelib"
authors = [{ name = "Felipe Maza", email = "felipe.maza@unican.es" }]
maintainers = [{ name = "Felipe Maza", email = "felipe.maza@unican.es" }]
readme = "README.md"
Expand Down
3 changes: 0 additions & 3 deletions src/template/__init__.py

This file was deleted.

6 changes: 0 additions & 6 deletions src/template/template.py

This file was deleted.

10 changes: 0 additions & 10 deletions src/template/tests/test_template.py

This file was deleted.

3 changes: 3 additions & 0 deletions src/templatelib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
""" Template """

__version__ = "0.1.1"
20 changes: 20 additions & 0 deletions src/templatelib/template.py
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.
20 changes: 20 additions & 0 deletions src/templatelib/tests/test_template.py
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

0 comments on commit d39d069

Please sign in to comment.