MCPcopy Create free account
hub / github.com/numpy/numpy / check_doctests

Function check_doctests

tools/refguide_check.py:836–909  ·  view source on GitHub ↗

Check code in docstrings of the module's public symbols. Parameters ---------- module : ModuleType Name of module verbose : bool Should the result be verbose ns : dict Name space of module dots : bool doctest_warnings : bool Returns

(module, verbose, ns=None,
                   dots=True, doctest_warnings=False)

Source from the content-addressed store, hash-verified

834
835
836def check_doctests(module, verbose, ns=None,
837 dots=True, doctest_warnings=False):
838 """
839 Check code in docstrings of the module's public symbols.
840
841 Parameters
842 ----------
843 module : ModuleType
844 Name of module
845 verbose : bool
846 Should the result be verbose
847 ns : dict
848 Name space of module
849 dots : bool
850
851 doctest_warnings : bool
852
853 Returns
854 -------
855 results : list
856 List of [(item_name, success_flag, output), ...]
857 """
858 if ns is None:
859 ns = dict(DEFAULT_NAMESPACE)
860
861 # Loop over non-deprecated items
862 results = []
863
864 for name in get_all_dict(module)[0]:
865 full_name = module.__name__ + '.' + name
866
867 if full_name in DOCTEST_SKIPDICT:
868 skip_methods = DOCTEST_SKIPDICT[full_name]
869 if skip_methods is None:
870 continue
871 else:
872 skip_methods = None
873
874 try:
875 obj = getattr(module, name)
876 except AttributeError:
877 import traceback
878 results.append((full_name, False,
879 "Missing item!\n" +
880 traceback.format_exc()))
881 continue
882
883 finder = doctest.DocTestFinder()
884 try:
885 tests = finder.find(obj, name, globs=dict(ns))
886 except Exception:
887 import traceback
888 results.append((full_name, False,
889 "Failed to get doctests!\n" +
890 traceback.format_exc()))
891 continue
892
893 if skip_methods is not None:

Callers 1

mainFunction · 0.85

Calls 6

get_all_dictFunction · 0.85
_run_doctestsFunction · 0.85
output_dotFunction · 0.85
findMethod · 0.80
partitionMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected