diff options
author | Robert Lehmann <mail@robertlehmann.de> | 2014-11-05 14:33:30 +0100 |
---|---|---|
committer | Robert Lehmann <mail@robertlehmann.de> | 2014-11-05 14:33:30 +0100 |
commit | b0d8345bc640d538d6504fa2e342b60c42ddc84e (patch) | |
tree | 3f332ce70b17024bfe591d8379e6f9f03698916c | |
parent | 17c0d3f51878cfcffe49fde093b7834948da2765 (diff) | |
download | sphinx-b0d8345bc640d538d6504fa2e342b60c42ddc84e.tar.gz |
Spec out configuration type checks.
-rw-r--r-- | tests/test_config.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_config.py b/tests/test_config.py index c11c0721..63a083f9 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -141,3 +141,32 @@ def test_check_types(app, status, warning): assert any(buf.startswith('WARNING:') and 'master_doc' in buf and 'int' in buf and 'str' in buf for buf in warning.buflist) + +@with_app(confoverrides={'man_pages': 123}) +def test_check_types_lambda(app, status, warning): + # WARNING: the config value 'man_pages' has type `int', defaults to `list.' + assert any(buf.startswith('WARNING:') + and 'man_pages' in buf and 'int' in buf and 'list' in buf + for buf in warning.buflist) + +@with_app(confoverrides={'man_pages': []}) +def test_check_types_lambda_negative(app, status, warning): + assert not any(buf.startswith('WARNING:') and 'man_pages' in buf + for buf in warning.buflist) + +@with_app(confoverrides={'epub_tocdepth': True}) +def test_check_types_child(app, status, warning): + # WARNING: the config value 'master_doc' has type `bool', defaults to `int.' + assert any(buf.startswith('WARNING:') + and 'epub_tocdepth' in buf and 'bool' in buf and 'int' in buf + for buf in warning.buflist) + +@with_app(confoverrides={'nitpicky': 3}) +def test_check_types_parent(app, status, warning): + assert not any(buf.startswith('WARNING:') and 'nitpicky' in buf + for buf in warning.buflist) + +@with_app(confoverrides={'html_add_permalinks': 'bar'}) +def test_check_types_sibling(app, status, warning): + assert not any(buf.startswith('WARNING:') and 'html_add_permalinks' in buf + for buf in warning.buflist) |