Add minimal datetime as testcase which should pass on all platforms

This commit is contained in:
Alexander Niederbühl 2019-07-15 07:49:31 +02:00
parent f642f19167
commit ad0a068a38
1 changed files with 2 additions and 1 deletions

View File

@ -4,7 +4,7 @@ import platform
import pytest import pytest
import rustapi_module.datetime as rdt import rustapi_module.datetime as rdt
from hypothesis import given from hypothesis import given, example
from hypothesis import strategies as st from hypothesis import strategies as st
from hypothesis.strategies import dates, datetimes from hypothesis.strategies import dates, datetimes
@ -240,6 +240,7 @@ def test_datetime_typeerror():
@given(dt=st.datetimes(MIN_DATETIME_FROM_TIMESTAMP, @given(dt=st.datetimes(MIN_DATETIME_FROM_TIMESTAMP,
MAX_DATETIME_FROM_TIMESTAMP)) MAX_DATETIME_FROM_TIMESTAMP))
@example(dt=pdt.datetime(1970, 1, 2, 0, 0))
def test_datetime_from_timestamp(dt): def test_datetime_from_timestamp(dt):
if PYPY and dt < pdt.datetime(1900, 1, 1): if PYPY and dt < pdt.datetime(1900, 1, 1):
pytest.xfail("get_timestamp will raise on PyPy with dates before 1900") pytest.xfail("get_timestamp will raise on PyPy with dates before 1900")