File: test_parser_prop.py

package info (click to toggle)
python-dateutil 2.9.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,316 kB
  • sloc: python: 12,720; makefile: 151; sh: 60
file content (22 lines) | stat: -rw-r--r-- 550 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from hypothesis.strategies import integers
from hypothesis import given

import pytest

from dateutil.parser import parserinfo


@pytest.mark.parserinfo
@given(integers(min_value=100, max_value=9999))
def test_convertyear(n):
    assert n == parserinfo().convertyear(n)


@pytest.mark.parserinfo
@given(integers(min_value=-50,
                max_value=49))
def test_convertyear_no_specified_century(n):
    p = parserinfo()
    new_year = p._year + n
    result = p.convertyear(new_year % 100, century_specified=False)
    assert result == new_year