File diff 7f45788235cf → 894f0440934b
tests/test_config.py
Show inline comments
...
 
@@ -342,3 +342,40 @@ def test_load_file_error(tmp_path, path_func):
 
def test_no_books_path():
 
    config = config_mod.Config()
 
    assert config.books_path() is None
 

	
 
@pytest.mark.parametrize('value,month,day', [
 
    ('2', 2, 1),
 
    ('3 ', 3, 1),
 
    ('  4', 4, 1),
 
    (' 5 ', 5, 1),
 
    ('6 1', 6, 1),
 
    ('  06  03  ', 6, 3),
 
    ('6-05', 6, 5),
 
    ('06 - 10', 6, 10),
 
    ('6/15', 6, 15),
 
    ('06  /  20', 6, 20),
 
    ('10.25', 10, 25),
 
    (' 10 . 30 ', 10, 30),
 
])
 
def test_fiscal_year_begin(value, month, day):
 
    config = config_mod.Config()
 
    config.load_string(f'[Beancount]\nfiscal year begin = {value}\n')
 
    assert config.fiscal_year_begin() == (month, day)
 

	
 
@pytest.mark.parametrize('value', [
 
    'text',
 
    '1900',
 
    '13',
 
    '010',
 
    '2 30',
 
    '4-31',
 
])
 
def test_bad_fiscal_year_begin(value):
 
    config = config_mod.Config()
 
    config.load_string(f'[Beancount]\nfiscal year begin = {value}\n')
 
    with pytest.raises(ValueError):
 
        config.fiscal_year_begin()
 

	
 
def test_default_fiscal_year_begin():
 
    config = config_mod.Config()
 
    assert config.fiscal_year_begin() == (3, 1)