2 Running doctest.__doc__
3 Trying: [1, 2, 3].remove(42)
5 Traceback (most recent call last):
6 File "<stdin>", line 1, in ?
7 ValueError: list.remove(x): x not in list
30 "es": # in the source code you'll see the doubled backslashes
34 Trying: assert "Easy!"
40 Trying: math.floor(1.9)
43 0 of 8 examples failed in doctest.__doc__
44 Running doctest.Tester.__doc__
45 Trying: from doctest import Tester
48 Trying: t = Tester(globs={'x': 42}, verbose=0)
58 *****************************************************************
59 Failure in example: print x
65 Trying: t.runstring(">>> x = x * 2\n>>> print x\n84\n", 'example2')
70 *****************************************************************
73 ***Test Failed*** 1 failures.
76 Trying: t.summarize(verbose=1)
78 1 items passed all tests:
80 *****************************************************************
84 3 passed and 1 failed.
85 ***Test Failed*** 1 failures.
88 0 of 6 examples failed in doctest.Tester.__doc__
89 Running doctest.Tester.__init__.__doc__
90 0 of 0 examples failed in doctest.Tester.__init__.__doc__
91 Running doctest.Tester.merge.__doc__
92 Trying: from doctest import Tester
95 Trying: t1 = Tester(globs={}, verbose=0)
106 Trying: t2 = Tester(globs={}, verbose=0)
117 Trying: common = ">>> assert 1 + 2 == 3\n"
120 Trying: t1.runstring(common, "common")
123 Trying: t2.runstring(common, "common")
127 Expecting: *** Tester.merge: 'common' in both testers; summing outcomes.
129 Trying: t1.summarize(1)
131 3 items passed all tests:
136 6 passed and 0 failed.
140 0 of 10 examples failed in doctest.Tester.merge.__doc__
141 Running doctest.Tester.run__test__.__doc__
142 0 of 0 examples failed in doctest.Tester.run__test__.__doc__
143 Running doctest.Tester.rundict.__doc__
156 Trying: d = {"_f": _f, "g": g}
159 Trying: t = Tester(globs={}, verbose=0)
162 Trying: t.rundict(d, "rundict_test") # _f is skipped
165 Trying: t = Tester(globs={}, verbose=0, isprivate=lambda x,y: 0)
168 Trying: t.rundict(d, "rundict_test_pvt") # both are searched
171 0 of 7 examples failed in doctest.Tester.rundict.__doc__
172 Running doctest.Tester.rundoc.__doc__
173 Trying: t = Tester(globs={}, verbose=0)
178 '''Trivial docstring example.
184 Trying: t.rundoc(_f) # expect 0 failures in 1 example
187 0 of 3 examples failed in doctest.Tester.rundoc.__doc__
188 Running doctest.Tester.runstring.__doc__
189 Trying: t = Tester(globs={}, verbose=1)
201 Trying: t.runstring(test, "Example")
203 Running string Example
210 0 of 2 examples failed in string Example
213 0 of 3 examples failed in doctest.Tester.runstring.__doc__
214 Running doctest.Tester.summarize.__doc__
215 0 of 0 examples failed in doctest.Tester.summarize.__doc__
216 Running doctest.is_private.__doc__
217 Trying: is_private("a.b", "my_func")
220 Trying: is_private("____", "_my_func")
223 Trying: is_private("someclass", "__init__")
226 Trying: is_private("sometypo", "__init_")
229 Trying: is_private("x.y.z", "_")
232 Trying: is_private("_x.y.z", "__")
235 Trying: is_private("", "") # senseless but consistent
238 0 of 7 examples failed in doctest.is_private.__doc__
239 Running doctest.run_docstring_examples.__doc__
240 0 of 0 examples failed in doctest.run_docstring_examples.__doc__
241 Running doctest.testmod.__doc__
242 0 of 0 examples failed in doctest.testmod.__doc__
243 Running doctest.__test__._TestClass.__doc__
244 Trying: _TestClass(13).get() + _TestClass(-12).get()
247 Trying: hex(_TestClass(13).square().get())
250 0 of 2 examples failed in doctest.__test__._TestClass.__doc__
251 Running doctest.__test__._TestClass.__init__.__doc__
252 Trying: t = _TestClass(123)
255 Trying: print t.get()
258 0 of 2 examples failed in doctest.__test__._TestClass.__init__.__doc__
259 Running doctest.__test__._TestClass.get.__doc__
260 Trying: x = _TestClass(-42)
263 Trying: print x.get()
266 0 of 2 examples failed in doctest.__test__._TestClass.get.__doc__
267 Running doctest.__test__._TestClass.square.__doc__
268 Trying: _TestClass(13).square().get()
271 0 of 1 examples failed in doctest.__test__._TestClass.square.__doc__
272 Running string doctest.__test__.string
279 0 of 2 examples failed in string doctest.__test__.string
280 5 items had no tests:
281 doctest.Tester.__init__
282 doctest.Tester.run__test__
283 doctest.Tester.summarize
284 doctest.run_docstring_examples
286 12 items passed all tests:
288 6 tests in doctest.Tester
289 10 tests in doctest.Tester.merge
290 7 tests in doctest.Tester.rundict
291 3 tests in doctest.Tester.rundoc
292 3 tests in doctest.Tester.runstring
293 2 tests in doctest.__test__._TestClass
294 2 tests in doctest.__test__._TestClass.__init__
295 2 tests in doctest.__test__._TestClass.get
296 1 tests in doctest.__test__._TestClass.square
297 2 tests in doctest.__test__.string
298 7 tests in doctest.is_private
299 53 tests in 17 items.
300 53 passed and 0 failed.