Skip to content

Rendu Baptiste Terral#33

Open
Baptiste-Terral wants to merge 3 commits intobcalou:mainfrom
Baptiste-Terral:main
Open

Rendu Baptiste Terral#33
Baptiste-Terral wants to merge 3 commits intobcalou:mainfrom
Baptiste-Terral:main

Conversation

@Baptiste-Terral
Copy link
Copy Markdown

No description provided.

@Baptiste-Terral Baptiste-Terral marked this pull request as draft November 15, 2023 14:36
@Baptiste-Terral Baptiste-Terral marked this pull request as ready for review November 15, 2023 14:43
@Baptiste-Terral Baptiste-Terral marked this pull request as draft November 15, 2023 14:46
@Baptiste-Terral Baptiste-Terral marked this pull request as ready for review November 15, 2023 15:54
Copy link
Copy Markdown
Owner

@bcalou bcalou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attention à bien suivre les pré-requis du readme

test_date.test_invalid_dates()

test_algorithm = TestAlgorithm()
test_algorithm.test_algorithm()
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attention, le fichier main doit demander la date à l'utilisasteur qui lance le script (voir readme).
Il ne doit pas appeler les tests, qui sont appelés par la commande uniittest (voir readme aussi).

def is_valid_date(date: str) -> bool:
return True
try:
year, month, day = map(int, date.split('-'))
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bien

except ValueError:
pass

return False
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rappellons que l'algo doit expliquer à l'utilisateur quelle est son erreur de saisie (pas dans le détail, mais au mois si c'est un problème de format ou de date non existante). Probablement à l'aide de print

Comment on lines +8 to +16
if 1 <= month <= 12 and 1 <= day <= 31:
if month in [4, 6, 9, 11] and day > 30:
return False
elif month == 2: # February
if day > 29:
return False
elif day == 29 and not (year % 4 == 0 and
(year % 100 != 0 or year % 400 == 0)):
return False # February 29 is only valid in leap years
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trouver comment applatir un peu cette structure très imbriquée ?

Comment on lines +11 to +13
week_days = ["Sunday", "Monday",
"Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"]
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Utiliser une constante en haut du fichier, et plutôt un tuple, structure immutable

return week_days[day_of_week]


def get_year_anchor(year: int) -> int:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vu ensemble, clarifier si possible

@bcalou
Copy link
Copy Markdown
Owner

bcalou commented Nov 24, 2023

Le programme doit demander une date à l'utilisateur, ce qu'il ne fait pas.
Les tests sont appelés via la commande dédiée, ce n'est pas au fichier main de le faire.
Code bien formatté, petit bémol sur la fonction is_valid_date qu'il aurait fallu découper car un peu complexe.
Attention à bien suivre les consignes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants