Esempio n. 1
0
def test_sphinx_doc_plugin__process_tests_sphinx_section():
    """
    Test :py:meth:`.SphinxDocPlugin.sphinxSection`.
    """
    plugin = SphinxDocPlugin()
    expected_result = '-----\nTests\n-----\n'
    result = plugin.sphinxSection('Tests')
    assert_equal(result, expected_result)

    expected_result = '=====\nTests\n=====\n'
    result = plugin.sphinxSection('Tests', section_char='=')
    assert_equal(result, expected_result)
Esempio n. 2
0
def test_sphinx_doc_plugin__process_tests_sphinx_section():
    """
    Test :py:meth:`.SphinxDocPlugin.sphinxSection`.
    """
    plugin = SphinxDocPlugin()
    expected_result = '-----\nTests\n-----\n'
    result = plugin.sphinxSection('Tests')
    assert_equal(result, expected_result)

    expected_result = '=====\nTests\n=====\n'
    result = plugin.sphinxSection('Tests', section_char='=')
    assert_equal(result, expected_result)
Esempio n. 3
0
def test_sphinx_doc_plugin___document_tests__empty():
    """
    Test :py:meth:`.SphinxDocPlugin._document_tests` with empty list of tests.
    """
    plugin = SphinxDocPlugin()
    plugin.sphinxSection = Mock()
    result = plugin._document_tests([])
    expected = ''
    assert_equal(result, expected)
    assert_equal(plugin.sphinxSection.call_count, 0)
Esempio n. 4
0
def test_sphinx_doc_plugin___document_tests__empty():
    """
    Test :py:meth:`.SphinxDocPlugin._document_tests` with empty list of tests.
    """
    plugin = SphinxDocPlugin()
    plugin.sphinxSection = Mock()
    result = plugin._document_tests([])
    expected = ''
    assert_equal(result, expected)
    assert_equal(plugin.sphinxSection.call_count, 0)
Esempio n. 5
0
def test_sphinx_doc_plugin___document_tests__function_test_case():
    """
    Test ``SphinxDocPlugin._document_tests`` with a ``FunctionTestCase``.

    Test :py:meth:`.SphinxDocPlugin._document_tests` with an instance of
    :py:class:`nose.case.FunctionTestCase`.
    """
    plugin = SphinxDocPlugin()
    plugin.sphinxSection = Mock(return_value='')
    plugin._document_test_case = Mock(return_value='')
    plugin._document_function_test_case = Mock(return_value='')
    result = plugin._document_tests([_get_function_test_case_info_mock()])
    #expect only \n, as section and test docs are mocked to return ''
    expected = '\n'
    assert_equal(result, expected)
    assert_equal(plugin.sphinxSection.call_count, 1)
    assert_equal(plugin._document_function_test_case.call_count, 1)
    assert_equal(plugin._document_test_case.call_count, 0)
Esempio n. 6
0
def test_sphinx_doc_plugin___document_tests__function_test_case():
    """
    Test ``SphinxDocPlugin._document_tests`` with a ``FunctionTestCase``.

    Test :py:meth:`.SphinxDocPlugin._document_tests` with an instance of
    :py:class:`nose.case.FunctionTestCase`.
    """
    plugin = SphinxDocPlugin()
    plugin.sphinxSection = Mock(return_value='')
    plugin._document_test_case = Mock(return_value='')
    plugin._document_function_test_case = Mock(return_value='')
    result = plugin._document_tests([_get_function_test_case_info_mock()])
    #expect only \n, as section and test docs are mocked to return ''
    expected = '\n'
    assert_equal(result, expected)
    assert_equal(plugin.sphinxSection.call_count, 1)
    assert_equal(plugin._document_function_test_case.call_count, 1)
    assert_equal(plugin._document_test_case.call_count, 0)