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

Function test_nested_only_skips_execution

tests/test_ipython_directive.py:115–138  ·  view source on GitHub ↗

Nested ``only`` with a false condition should skip execution. When ``only:: html`` is true but the inner ``only:: latex`` is false, the ipython directive inside the inner block should skip.

()

Source from the content-addressed store, hash-verified

113
114
115def test_nested_only_skips_execution():
116 """Nested ``only`` with a false condition should skip execution.
117
118 When ``only:: html`` is true but the inner ``only:: latex`` is
119 false, the ipython directive inside the inner block should skip.
120 """
121 n = _build_sphinx(
122 """
123Test
124====
125
126.. only:: html
127
128 .. only:: latex
129
130 .. ipython::
131
132 In [1]: x = 1
133""",
134 builder="html",
135 tags=["html"],
136 )
137 # The inner only:: latex is excluded, so no execution.
138 assert n == 0

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…