Ejemplo n.º 1
0
def test_parse_string_to_bounds_month_dec(date_type, dec_days):
    parsed = date_type(2, 12, 1)
    expected_start = date_type(2, 12, 1)
    expected_end = date_type(2, 12, dec_days, 23, 59, 59, 999999)
    result_start, result_end = _parsed_string_to_bounds(date_type, "month", parsed)
    assert result_start == expected_start
    assert result_end == expected_end
Ejemplo n.º 2
0
def test_parse_string_to_bounds_year(date_type, dec_days):
    parsed = date_type(2, 2, 10, 6, 2, 8, 1)
    expected_start = date_type(2, 1, 1)
    expected_end = date_type(2, 12, dec_days, 23, 59, 59, 999999)
    result_start, result_end = _parsed_string_to_bounds(date_type, "year", parsed)
    assert result_start == expected_start
    assert result_end == expected_end
Ejemplo n.º 3
0
def test_parse_string_to_bounds_month_feb(date_type, feb_days):
    parsed = date_type(2, 2, 10, 6, 2, 8, 1)
    expected_start = date_type(2, 2, 1)
    expected_end = date_type(2, 2, feb_days, 23, 59, 59, 999999)
    result_start, result_end = _parsed_string_to_bounds(
        date_type, 'month', parsed)
    assert result_start == expected_start
    assert result_end == expected_end
Ejemplo n.º 4
0
def test_parse_string_to_bounds_month_dec(date_type, dec_days):
    parsed = date_type(2, 12, 1)
    expected_start = date_type(2, 12, 1)
    expected_end = date_type(2, 12, dec_days, 23, 59, 59, 999999)
    result_start, result_end = _parsed_string_to_bounds(
        date_type, 'month', parsed)
    assert result_start == expected_start
    assert result_end == expected_end
Ejemplo n.º 5
0
def test_parse_string_to_bounds_year(date_type, dec_days):
    parsed = date_type(2, 2, 10, 6, 2, 8, 1)
    expected_start = date_type(2, 1, 1)
    expected_end = date_type(2, 12, dec_days, 23, 59, 59, 999999)
    result_start, result_end = _parsed_string_to_bounds(
        date_type, 'year', parsed)
    assert result_start == expected_start
    assert result_end == expected_end
Ejemplo n.º 6
0
def test_parsed_string_to_bounds_sub_monthly(date_type, reso, ex_start_args,
                                             ex_end_args):
    parsed = date_type(2, 2, 10, 6, 2, 8, 123456)
    expected_start = date_type(*ex_start_args)
    expected_end = date_type(*ex_end_args)

    result_start, result_end = _parsed_string_to_bounds(
        date_type, reso, parsed)
    assert result_start == expected_start
    assert result_end == expected_end
Ejemplo n.º 7
0
def test_parsed_string_to_bounds_sub_monthly(date_type, reso,
                                             ex_start_args, ex_end_args):
    parsed = date_type(2, 2, 10, 6, 2, 8, 123456)
    expected_start = date_type(*ex_start_args)
    expected_end = date_type(*ex_end_args)

    result_start, result_end = _parsed_string_to_bounds(
        date_type, reso, parsed)
    assert result_start == expected_start
    assert result_end == expected_end
Ejemplo n.º 8
0
def test_parsed_string_to_bounds_raises(date_type):
    with pytest.raises(KeyError):
        _parsed_string_to_bounds(date_type, 'a', date_type(1, 1, 1))
Ejemplo n.º 9
0
def test_parsed_string_to_bounds_raises(date_type):
    with pytest.raises(KeyError):
        _parsed_string_to_bounds(date_type, 'a', date_type(1, 1, 1))