From 11e73ce20a6558a1a65eefd0db204adf936d4e65 Mon Sep 17 00:00:00 2001 From: Gustavo Berned Date: Wed, 25 Sep 2024 20:30:19 -0300 Subject: [PATCH] Improve coverage and remove test dependency --- pyproject.toml | 1 - tests/test_date.py | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 8c9416cb..7d967168 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/tests/test_date.py b/tests/test_date.py index 54d4f9d5..91f15adb 100644 --- a/tests/test_date.py +++ b/tests/test_date.py @@ -2,6 +2,7 @@ from num2words import num2words +from brutils.data.enums.months import MonthsEnum from brutils.date import convert_date_to_text @@ -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") @@ -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)