-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2753.py
32 lines (22 loc) · 835 Bytes
/
2753.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# [ 백준 ] 2753번: 윤년
def solution() -> None:
year: int = int(input())
if (not (year % 4) and (year % 100)) or not (year % 400):
print(1)
else:
print(0)
if __name__ == "__main__":
from io import StringIO
from unittest.mock import patch
def test_example_case(input: list[str]) -> int:
with patch("builtins.input", side_effect=input):
with patch("sys.stdout", new_callable=StringIO) as test_stdout:
solution()
return test_stdout.getvalue()
cases: list[dict[str, list[str] | int]] = [
{"input": ["2000"], "output": 1},
{"input": ["1999"], "output": 0},
]
for case in cases:
output: int = case["output"]
assert f"{output}\n" == test_example_case(input=case["input"])