xdoctest.utils.util_misc module¶
Utilities that are mainly used in self-testing
- class xdoctest.utils.util_misc.TempDoctest(docstr, modname=None)[source]¶
Bases:
object
Creates a temporary file containing a module-level doctest for testing
Example
>>> from xdoctest import core >>> self = TempDoctest('>>> a = 1') >>> doctests = list(core.parse_doctestables(self.modpath)) >>> assert len(doctests) == 1
- class xdoctest.utils.util_misc.TempModule(module_text, modname=None)[source]¶
Bases:
object
Creates a temporary directory with a python module.
Example
>>> from xdoctest import core >>> self = TempDoctest('>>> a = 1') >>> doctests = list(core.parse_doctestables(self.modpath)) >>> assert len(doctests) == 1