1 84
from hypothesis.strategies import integers
2 84
from hypothesis import given
3

4 84
import pytest
5

6 84
from dateutil.parser import parserinfo
7

8

9 84
@pytest.mark.parserinfo
10 84
@given(integers(min_value=100, max_value=9999))
11 27
def test_convertyear(n):
12 84
    assert n == parserinfo().convertyear(n)
13

14

15 84
@pytest.mark.parserinfo
16 84
@given(integers(min_value=-50,
17
                max_value=49))
18 27
def test_convertyear_no_specified_century(n):
19 84
    p = parserinfo()
20 84
    new_year = p._year + n
21 84
    result = p.convertyear(new_year % 100, century_specified=False)
22 84
    assert result == new_year

Read our documentation on viewing source code .

Loading