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 | ed5f77916f70de418b3854c6f61be461cc4d1459 (patch) | |
| tree | 3f332ce70b17024bfe591d8379e6f9f03698916c /tests/test_config.py | |
| parent | 49d9efa13b065328d40a5cecfc178307236f2a43 (diff) | |
| download | sphinx-git-ed5f77916f70de418b3854c6f61be461cc4d1459.tar.gz | |
Spec out configuration type checks.
Diffstat (limited to 'tests/test_config.py')
| -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 c11c07219..63a083f97 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) |
