-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3976 from pyramsd/reto#26
Reto #26 - python
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import datetime | ||
|
||
|
||
def viernes_trece(year, month): | ||
|
||
date = datetime.date(year, month, 13) | ||
|
||
if date.weekday() == 4: | ||
return True | ||
else: | ||
return False | ||
|
||
|
||
# se espera un resultado falso de la fecha datetime.MAXYEAR(9999) y el mes 1(enero) | ||
def test_invalid_year_1(): | ||
assert not viernes_trece(datetime.MAXYEAR, 1) | ||
|
||
|
||
# se espera un resultado falso de la fecha 1900 de enero | ||
def test_no_viernes_trece(): | ||
assert not viernes_trece(1900, 1) | ||
|
||
|
||
# se espera un resultado verdadero de la fecha 2023 de enero | ||
def test_si_viernes_trece(): | ||
assert viernes_trece(2023, 1) | ||
|
||
# --!! run: pytest pyramsd.py |