File diff b37575eabc84 → ab9c65d20dc5
tests/test_config.py
Show inline comments
 
import contextlib
 
import datetime
 
import itertools
 
import logging
 
import os
 
import pathlib
...
 
@@ -63,6 +64,22 @@ def test_output_path_from_section():
 
    with config.from_section('Templates'):
 
        assert config.get_output_path() == expected_path
 

	
 
@pytest.mark.parametrize('range_s,date_fmt', [
 
    (range_s.replace('/', sep), sep.join(['%Y', '%m', '%d']))
 
    for range_s, sep in itertools.product([
 
            '-',
 
            '2016/06/01-2016/06/30',
 
            '2016/06/01-',
 
            '-2016/06/30',
 
            ], '/-')
 
])
 
def test_date_in_want_range(range_s, date_fmt):
 
    config = config_from_file(os.devnull, ['--date-range=' + range_s, '--date-format', date_fmt])
 
    assert config.date_in_want_range(datetime.date(2016, 5, 31)) == range_s.startswith('-')
 
    assert config.date_in_want_range(datetime.date(2016, 6, 1))
 
    assert config.date_in_want_range(datetime.date(2016, 6, 30))
 
    assert config.date_in_want_range(datetime.date(2016, 7, 1)) == range_s.endswith('-')
 

	
 
@pytest.mark.parametrize('arglist,expect_date', [
 
    ([], None),
 
    (['-d', '2017-10-12'], datetime.date(2017, 10, 12)),