MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_collect_testtextfile

Method test_collect_testtextfile

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

maketxtfileMethod · 0.45
inline_genitemsMethod · 0.45

Tested by

no test coverage detected