diff options
Diffstat (limited to 'tests/test_ext_doctest.py')
-rw-r--r-- | tests/test_ext_doctest.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_ext_doctest.py b/tests/test_ext_doctest.py index fec9a44d0..705f6262a 100644 --- a/tests/test_ext_doctest.py +++ b/tests/test_ext_doctest.py @@ -9,6 +9,7 @@ :license: BSD, see LICENSE for details. """ import pytest +from sphinx.ext.doctest import compare_version cleanup_called = 0 @@ -25,6 +26,21 @@ def test_build(app, status, warning): assert cleanup_called == 3, 'testcleanup did not get executed enough times' +def test_compare_version(): + assert compare_version('3.3', '3.4', '<') is True + assert compare_version('3.3', '3.2', '<') is False + assert compare_version('3.3', '3.4', '<=') is True + assert compare_version('3.3', '3.2', '<=') is False + assert compare_version('3.3', '3.3', '==') is True + assert compare_version('3.3', '3.4', '==') is False + assert compare_version('3.3', '3.2', '>=') is True + assert compare_version('3.3', '3.4', '>=') is False + assert compare_version('3.3', '3.2', '>') is True + assert compare_version('3.3', '3.4', '>') is False + with pytest.raises(ValueError): + compare_version('3.3', '3.4', '+') + + def cleanup_call(): global cleanup_called cleanup_called += 1 |