Skip to content

Commit

Permalink
Improve coverage and remove test dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
BeneBr committed Sep 25, 2024
1 parent 965980b commit 11e73ce
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ num2words = "0.5.13"

[tool.poetry.group.test.dependencies]
coverage = "^7.2.7"
num2words = "0.5.13"

[tool.poetry.group.dev.dependencies]
ruff = ">=0.5.0,<0.7.0"
Expand Down
22 changes: 22 additions & 0 deletions tests/test_date.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from num2words import num2words

from brutils.data.enums.months import MonthsEnum
from brutils.date import convert_date_to_text


Expand Down Expand Up @@ -41,6 +42,7 @@ def test_convert_date_to_text(self):
self.assertIsNone(convert_date_to_text("30/02/2000"), None)
self.assertIsNone(convert_date_to_text("50/09/2000"), None)
self.assertIsNone(convert_date_to_text("25/15/2000"), None)
self.assertIsNone(convert_date_to_text("29/02/2019"), None)

# Invalid date pattern.
self.assertRaises(ValueError, convert_date_to_text, "Invalid")
Expand All @@ -56,3 +58,23 @@ def test_convert_date_to_text(self):
convert_date_to_text("01/01/1900"),
"Primeiro de janeiro de mil e novecentos",
)

months_year = [
(1, "janeiro"),
(2, "fevereiro"),
(3, "marco"),
(4, "abril"),
(5, "maio"),
(6, "junho"),
(7, "julho"),
(8, "agosto"),
(9, "setembro"),
(10, "outubro"),
(11, "novembro"),
(12, "dezembro"),
]

def testMonthEnum(self):
for day, month in self.months_year:
mont = MonthsEnum(day)
self.assertEqual(mont.mont_name, month)

0 comments on commit 11e73ce

Please sign in to comment.