MCPcopy Index your code
hub / github.com/ipython/ipython / test_only_included_executes_normally

Function test_only_included_executes_normally

tests/test_ipython_directive.py:87–112  ·  view source on GitHub ↗

Code inside an included ``only`` block should execute normally. When building with the html builder, an ``only:: html`` directive should allow the ipython directive to execute code as usual.

()

Source from the content-addressed store, hash-verified

85
86
87def test_only_included_executes_normally():
88 """Code inside an included ``only`` block should execute normally.
89
90 When building with the html builder, an ``only:: html`` directive
91 should allow the ipython directive to execute code as usual.
92 """
93 n = _build_sphinx(
94 """
95Test
96====
97
98.. only:: html
99
100 .. ipython::
101
102 In [1]: x = 1
103
104.. ipython::
105
106 In [1]: y = 2
107""",
108 builder="html",
109 tags=["html"],
110 )
111 # Both directives should execute.
112 assert n == 2
113
114
115def test_nested_only_skips_execution():

Callers

nothing calls this directly

Calls 1

_build_sphinxFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…