394 - Converter data no formato brasileiro para uma representação textual by BeneBr · Pull Request #415 · brazilian-utils/python
Descrição
Possibilitar aos usuários uma forma de ter uma representação textual de uma data no formato brasileito (dd/mm/aaa)
Mudanças Propostas
-
Adicionada uma nova dependência
num2wordsno qual transforma um determinado número em uma representação textual em vários idiomas; -
Adicionada uma free function
convert_date_to_textonde os usuários podem passar uma string no formato dd/mm/aaaa e obter uma representação textual;
Checklist de Revisão
- Eu li o Contributing.md
- Os testes foram adicionados ou atualizados para refletir as mudanças (se aplicável).
- Foi adicionada uma entrada no changelog / Meu PR não necessita de uma nova entrada no changelog.
- A documentação em português foi atualizada ou criada, se necessário.
- Se feita a documentação, a atualização do arquivo em inglês.
- Eu documentei as minhas mudanças no código, adicionando docstrings e comentários. Instruções
- O código segue as diretrizes de estilo e padrões de codificação do projeto.
- Todos os testes passam. Instruções
- O Pull Request foi testado localmente. Instruções
- Não há conflitos de mesclagem.
Comentários Adicionais (opcional)
Issue Relacionada
Closes #394
Codecov Report
All modified and coverable lines are covered by tests ✅
Project coverage is 99.83%. Comparing base (
d7b645d) to head (19e29e5).
Report is 1 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@ ## main #415 +/- ## ========================================== + Coverage 99.80% 99.83% +0.02% ========================================== Files 19 21 +2 Lines 521 591 +70 ========================================== + Hits 520 590 +70 Misses 1 1
☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.
Comment on lines +77 to +80
| def testMonthEnum(self): | ||
| for day, month in self.months_year: | ||
| mont = MonthsEnum(day) | ||
| self.assertEqual(mont.mont_name, month) |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| def testMonthEnum(self): | |
| for day, month in self.months_year: | |
| mont = MonthsEnum(day) | |
| self.assertEqual(mont.mont_name, month) | |
| def testMonthEnum(self): | |
| for mont_number, month in self.months_year: | |
| mont = MonthsEnum(month_number) | |
| self.assertEqual(mont.mont_name, month) |
|
|
||
| ```sh | ||
| $ poetry env inf | ||
| $ poetry env info |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boaa!! Obrigada pelos olhos de lince!! 👀
| Exemplo: | ||
|
|
||
| ````python | ||
| >>> from brutils.date import convert_date_to_text |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Só para entrar no padrão dos outros imports :)
| >>> from brutils.date import convert_date_to_text | |
| >>> from brutils import convert_date_to_text |
| Example: | ||
|
|
||
| ````python | ||
| >>> from brutils.date import convert_date_to_text |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| >>> from brutils.date import convert_date_to_text | |
| >>> from brutils import convert_date_to_text |
| DEZEMBRO = 12 | ||
|
|
||
| @property | ||
| def mont_name(self) -> str: |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| def mont_name(self) -> str: | |
| def month_name(self) -> str: |
| date_string = ( | ||
| day_string.capitalize() | ||
| + " de " | ||
| + month.mont_name |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| + month.mont_name | |
| + month.month_name |
Comment on lines +77 to +80
| def testMonthEnum(self): | ||
| for day, month in self.months_year: | ||
| mont = MonthsEnum(day) | ||
| self.assertEqual(mont.mont_name, month) |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| def testMonthEnum(self): | |
| for day, month in self.months_year: | |
| mont = MonthsEnum(day) | |
| self.assertEqual(mont.mont_name, month) | |
| def testMonthEnum(self): | |
| for day, month in self.months_year: | |
| month = MonthsEnum(day) | |
| self.assertEqual(month.month_name, month) |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Na verdade os nomes do teste em si estavam errados, acabei de alterá-los para isso:
def testMonthEnum(self): for number_month, name_month in self.months_year: month = MonthsEnum(number_month) self.assertEqual(month.month_name, name_month)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boa, @BeneBr, mandaram ver!! Obrigada pela contribuição, ajustei apenas alguns detalhes, qualquer coisa só chamar a gente!! 🥇
This file contains hidden or 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