-
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 #3954 from Hugovrc/main
Reto #26 - Python
- Loading branch information
Showing
1 changed file
with
24 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,24 @@ | ||
from datetime import datetime | ||
import unittest | ||
|
||
def FridayThe13th(month, year): | ||
date = datetime(year, month, 13) | ||
|
||
return True if date.weekday() == 4 else False | ||
|
||
class test_viernes_13(unittest.TestCase): | ||
def test_1(self): | ||
self.assertTrue(FridayThe13th(1,2023)) | ||
def test_2(self): | ||
self.assertEqual(FridayThe13th(1,2025),False) | ||
def test_3(self): | ||
with self.assertRaises(TypeError): | ||
FridayThe13th("01","2026") | ||
def test_4(self): | ||
self.assertEqual(FridayThe13th("1","2023"),True) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() | ||
|
||
|