mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Add is_valid_date unit test
This commit is contained in:
parent
36b9b79a69
commit
bb96b0bc37
1 changed files with 22 additions and 0 deletions
|
@ -3,6 +3,8 @@
|
|||
|
||||
import datetime
|
||||
|
||||
import pytest
|
||||
|
||||
from jrnl import time
|
||||
|
||||
|
||||
|
@ -20,3 +22,23 @@ def test_default_minute_is_added():
|
|||
default_minute=30,
|
||||
bracketed=False,
|
||||
) == datetime.datetime(2020, 6, 20, 0, 30)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"inputs",
|
||||
[
|
||||
[2000, 2, 29, True],
|
||||
[2023, 1, 0, False],
|
||||
[2023, 1, 1, True],
|
||||
[2023, 4, 31, False],
|
||||
[2023, 12, 31, True],
|
||||
[2023, 12, 32, False],
|
||||
[2023, 13, 1, False],
|
||||
[2100, 2, 27, True],
|
||||
[2100, 2, 28, True],
|
||||
[2100, 2, 29, False],
|
||||
],
|
||||
)
|
||||
def test_is_valid_date(inputs):
|
||||
year, month, day, expected_result = inputs
|
||||
assert time.is_valid_date(year, month, day) == expected_result
|
||||
|
|
Loading…
Add table
Reference in a new issue