1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This module checks that :obj: works as expected.
It works by re-using almost all of the code from `test_code_include` and
just changes a few functions to test for the :obj: tag.
"""
from . import test_code_include
class Linking(test_code_include.Linking):
"""A class that checks if linking to source code and documentation works."""
@staticmethod
def _get_fake_project_method() -> list[str]:
return [":obj:`fake_project.basic.MyKlass.get_method`"]
class RenderText(test_code_include.RenderText):
"""A class that checks to make sure projects get and return the right code."""
@staticmethod
def _get_fake_project_method() -> list[str]:
return [":obj:`fake_project.basic.MyKlass.get_method`"]
@staticmethod
def _get_fake_project_class() -> list[str]:
return [":obj:`fake_project.basic.MyKlass`"]
@staticmethod
def _get_fake_project_function() -> list[str]:
return [":obj:`fake_project.basic.set_function_thing`"]
@staticmethod
def _get_fake_project_private_function() -> list[str]:
return [":obj:`fake_project.basic._set_private_function_thing`"]
@staticmethod
def _get_fake_project_module() -> list[str]:
return [":obj:`fake_project.basic`"]
class RenderTextNested(test_code_include.RenderTextNested):
"""Make sure that nested HTML rendering works as expected."""
@staticmethod
def _get_fake_project_nested_method() -> list[str]:
return [":obj:`fake_project.nested_folder.another.MyKlass.get_method`"]
@staticmethod
def _get_fake_project_nested_class() -> list[str]:
return [":obj:`fake_project.nested_folder.another.MyKlass`"]
@staticmethod
def _get_fake_project_nested_function() -> list[str]:
return [":obj:`fake_project.nested_folder.another.set_function_thing`"]
@staticmethod
def _get_fake_project_nested_private_function() -> list[str]:
return [":obj:`fake_project.nested_folder.another._set_private_function_thing`"]
@staticmethod
def _get_fake_project_nested_module() -> list[str]:
return [":obj:`fake_project.nested_folder.another`"]
class Options(test_code_include.Options):
"""Make sure code-include directive options work for :obj: tags."""
@staticmethod
def _get_fake_project_method() -> list[str]:
return [":obj:`fake_project.basic.MyKlass.get_method`"]
@staticmethod
def _get_fake_project_function() -> list[str]:
return [":obj:`fake_project.basic.set_function_thing`"]
|