Lines Matching refs:globs
183 def _extract_future_flags(globs):
186 have been imported into the given namespace (globs).
190 feature = globs.get(fname, None)
512 - globs: The namespace (aka globals) that the examples should
529 def __init__(self, examples, globs, name, filename, lineno, docstring):
532 DocTest's globals are initialized with a copy of `globs`.
538 self.globs = globs.copy()
560 self.globs == other.globs and \
667 def get_doctest(self, string, globs, name, filename, lineno):
672 `globs`, `name`, `filename`, and `lineno` are attributes for
676 return DocTest(self.get_examples(string, name), globs,
846 def find(self, obj, name=None, module=None, globs=None, extraglobs=None):
857 - As a default namespace, if `globs` is not specified.
872 The globals for each DocTest is formed by combining `globs`
874 in `globs`). A new copy of the globals dictionary is created
875 for each DocTest. If `globs` is not specified, then it
926 if globs is None:
928 globs = {}
930 globs = module.__dict__.copy()
932 globs = globs.copy()
934 globs.update(extraglobs)
935 if '__name__' not in globs:
936 globs['__name__'] = '__main__' # provide a default module name
940 self._find(tests, obj, name, module, source_lines, globs, {})
988 def _find(self, tests, obj, name, module, source_lines, globs, seen):
1002 test = self._get_test(obj, name, module, globs, source_lines)
1015 globs, seen)
1032 globs, seen)
1047 globs, seen)
1049 def _get_test(self, obj, name, module, globs, source_lines):
1084 return self._parser.get_doctest(docstring, globs, name,
1302 in the namespace `test.globs`.
1346 # Run the example in the given context (globs), and record
1352 compileflags, True), test.globs)
1445 The examples are run in the namespace `test.globs`. If
1454 flags that apply to `globs`.
1463 compileflags = _extract_future_flags(test.globs)
1506 test.globs.clear()
1826 >>> del test.globs['__builtins__']
1827 >>> test.globs
1840 >>> del test.globs['__builtins__']
1841 >>> test.globs
1853 >>> test.globs
1861 test.globs.clear()
1879 def testmod(m=None, name=None, globs=None, verbose=None,
1882 """m=None, name=None, globs=None, verbose=None, report=True,
1902 Optional keyword arg "globs" gives a dict to be used as the globals
1970 for test in finder.find(m, name, globs=globs, extraglobs=extraglobs):
1984 globs=None, verbose=None, report=True, optionflags=0,
2015 Optional keyword arg "globs" gives a dict to be used as the globals
2078 if globs is None:
2079 globs = {}
2081 globs = globs.copy()
2083 globs.update(extraglobs)
2084 if '__name__' not in globs:
2085 globs['__name__'] = '__main__'
2093 test = parser.get_doctest(text, globs, name, filename, 0)
2106 def run_docstring_examples(f, globs, verbose=False, name="NoName",
2109 Test examples in the given object's docstring (`f`), using `globs`
2117 `globs`.
2126 for test in finder.find(f, name, globs=globs):
2179 self._dt_globs = test.globs.copy()
2196 # restore the original globs
2197 test.globs.clear()
2198 test.globs.update(self._dt_globs)
2357 def DocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None,
2379 globs attribute of the test passed.
2385 globs attribute of the test passed.
2387 globs
2398 tests = test_finder.find(module, globs=globs, extraglobs=extraglobs)
2435 globs=None, parser=DocTestParser(),
2437 if globs is None:
2438 globs = {}
2440 globs = globs.copy()
2450 if "__file__" not in globs:
2451 globs["__file__"] = path
2457 test = parser.get_doctest(doc, globs, name, path, 0)
2495 globs attribute of the test passed.
2501 globs attribute of the test passed.
2503 globs
2631 def debug_src(src, pm=False, globs=None):
2634 debug_script(testsrc, pm, globs)
2636 def debug_script(src, pm=False, globs=None):
2640 if globs:
2641 globs = globs.copy()
2643 globs = {}
2647 exec(src, globs, globs)
2654 pdb.Pdb(nosigint=True).run("exec(%r)" % src, globs, globs)