MCPcopy
hub / github.com/pytest-dev/pytest / test_collect_testtextfile

Method test_collect_testtextfile

testing/test_doctest.py:23–42  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

21
22class TestDoctests:
23 def test_collect_testtextfile(self, pytester: Pytester):
24 w = pytester.maketxtfile(whatever="")
25 checkfile = pytester.maketxtfile(
26 test_something="""
27 alskdjalsdk
28 >>> i = 5
29 >>> i-1
30 4
31 """
32 )
33
34 for x in (pytester.path, checkfile):
35 # print "checking that %s returns custom items" % (x,)
36 items, _reprec = pytester.inline_genitems(x)
37 assert len(items) == 1
38 assert isinstance(items[0], DoctestItem)
39 assert isinstance(items[0].parent, DoctestTextfile)
40 # Empty file has no items.
41 items, _reprec = pytester.inline_genitems(w)
42 assert len(items) == 0
43
44 def test_collect_module_empty(self, pytester: Pytester):
45 path = pytester.makepyfile(whatever="#")

Callers

nothing calls this directly

Calls 2

maketxtfileMethod · 0.45
inline_genitemsMethod · 0.45

Tested by

no test coverage detected