Example #1
0
def test_sphinx_doc_plugin___document_function_test_case():
    """
    Test :py:meth:`.SphinxDocPlugin._document_funtion_test_case`.
    """
    plugin = SphinxDocPlugin()
    test_info = {
        'name': 'test_me',
        'module': 'module',
        'test': _get_test_case_mock(),
        'type': 'FunctionTestCase',
    }
    expected = '    .. autofunction:: module.test_me\n\n'
    assert_equal(plugin._document_function_test_case(test_info), expected)
Example #2
0
def test_sphinx_doc_plugin___document_function_test_case():
    """
    Test :py:meth:`.SphinxDocPlugin._document_funtion_test_case`.
    """
    plugin = SphinxDocPlugin()
    test_info = {
        'name': 'test_me',
        'module': 'module',
        'test': _get_test_case_mock(),
        'type': 'FunctionTestCase',
    }
    expected = '    .. autofunction:: module.test_me\n\n'
    assert_equal(plugin._document_function_test_case(test_info), expected)
Example #3
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)
Example #4
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)