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

4 20
import pytest
5

6 20
from dateutil.parser import parserinfo
7

8

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

14

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

Read our documentation on viewing source code .

Loading