@@ -87,7 +87,7 @@ def test_basic(doctree, buildername):
87
87
assert cell .attributes ["code_below" ] is False
88
88
assert cell .attributes ["hide_code" ] is False
89
89
assert cell .attributes ["hide_output" ] is False
90
- assert cell . attributes ["linenos" ] is False
90
+ assert cellinput . children [ 0 ] ["linenos" ] is False
91
91
assert cellinput .children [0 ].rawsource .strip () == "2 + 2"
92
92
assert celloutput .children [0 ].rawsource .strip () == "4"
93
93
@@ -104,7 +104,7 @@ def test_basic_old_entrypoint(doctree):
104
104
assert cell .attributes ["code_below" ] is False
105
105
assert cell .attributes ["hide_code" ] is False
106
106
assert cell .attributes ["hide_output" ] is False
107
- assert cell . attributes ["linenos" ] is False
107
+ assert cellinput . children [ 0 ] ["linenos" ] is False
108
108
assert cellinput .children [0 ].rawsource .strip () == "2 + 2"
109
109
assert celloutput .children [0 ].rawsource .strip () == "4"
110
110
@@ -164,7 +164,7 @@ def test_linenos(doctree):
164
164
tree = doctree (source )
165
165
(cell ,) = tree .traverse (JupyterCellNode )
166
166
(cellinput , celloutput ) = cell .children
167
- assert cell . attributes ["linenos" ] is True
167
+ assert cellinput . children [ 0 ] ["linenos" ] is True
168
168
assert len (cell .children ) == 2
169
169
assert cellinput .children [0 ].rawsource .strip () == "2 + 2"
170
170
assert celloutput .children [0 ].rawsource .strip () == "4"
@@ -177,9 +177,8 @@ def test_linenos(doctree):
177
177
"""
178
178
tree = doctree (source )
179
179
(cell ,) = tree .traverse (JupyterCellNode )
180
- (cellinput , celloutput ) = cell .children
181
- assert len (cell .children ) == 2
182
- assert cell .attributes ["linenos" ] is True
180
+ (celloutput , cellinput ) = cell .children
181
+ assert cellinput .children [0 ]["linenos" ] is True
183
182
184
183
185
184
def test_linenos_conf_option (doctree ):
@@ -191,8 +190,8 @@ def test_linenos_conf_option(doctree):
191
190
tree = doctree (source , config = "jupyter_sphinx_linenos = True" )
192
191
(cell ,) = tree .traverse (JupyterCellNode )
193
192
(cellinput , celloutput ) = cell .children
194
- assert cellinput .attributes ["linenos" ]
195
- assert "highlight_args" not in cellinput .attributes
193
+ assert cellinput .children [ 0 ]. attributes ["linenos" ]
194
+ assert "highlight_args" not in cellinput .children [ 0 ]. attributes
196
195
assert cellinput .children [0 ].rawsource .strip () == "2 + 2"
197
196
assert celloutput .children [0 ].rawsource .strip () == "4"
198
197
@@ -209,7 +208,7 @@ def test_continue_linenos_conf_option(doctree):
209
208
tree = doctree (source , config = "jupyter_sphinx_continue_linenos = True" )
210
209
(cell ,) = tree .traverse (JupyterCellNode )
211
210
(cellinput , celloutput ) = cell .children
212
- assert "linenos" not in cellinput .attributes
211
+ assert not cellinput .children [ 0 ]. attributes [ "linenos" ]
213
212
assert cellinput .children [0 ].rawsource .strip () == "2 + 2"
214
213
assert celloutput .children [0 ].rawsource .strip () == "4"
215
214
@@ -234,12 +233,12 @@ def test_continue_linenos_conf_option(doctree):
234
233
cell0 , cell1 = tree .traverse (JupyterCellNode )
235
234
(cellinput0 , celloutput0 ) = cell0 .children
236
235
(cellinput1 , celloutput1 ) = cell1 .children
237
- assert cellinput0 .attributes ["linenos" ]
236
+ assert cellinput0 .children [ 0 ]. attributes ["linenos" ]
238
237
assert cellinput0 .children [0 ].rawsource .strip () == "2 + 2"
239
238
assert celloutput0 .children [0 ].rawsource .strip () == "4"
240
239
241
- assert cellinput1 .attributes ["linenos" ]
242
- assert cellinput1 .attributes ["highlight_args" ]["linenostart" ] == 2
240
+ assert cellinput1 .children [ 0 ]. attributes ["linenos" ]
241
+ assert cellinput1 .children [ 0 ]. attributes ["highlight_args" ]["linenostart" ] == 2
243
242
assert cellinput1 .children [0 ].rawsource .strip () == "3 + 3"
244
243
assert celloutput1 .children [0 ].rawsource .strip () == "6"
245
244
@@ -264,12 +263,12 @@ def test_continue_linenos_conf_option(doctree):
264
263
cell0 , cell1 = tree .traverse (JupyterCellNode )
265
264
(cellinput0 , celloutput0 ) = cell0 .children
266
265
(cellinput1 , celloutput1 ) = cell1 .children
267
- assert cellinput0 .attributes ["highlight_args" ]["linenostart" ] == 7
266
+ assert cellinput0 .children [ 0 ]. attributes ["highlight_args" ]["linenostart" ] == 7
268
267
assert cellinput0 .children [0 ].rawsource .strip () == "2 + 2"
269
268
assert celloutput0 .children [0 ].rawsource .strip () == "4"
270
269
271
- assert cellinput1 .attributes ["linenos" ]
272
- assert cellinput1 .attributes ["highlight_args" ]["linenostart" ] == 8
270
+ assert cellinput1 .children [ 0 ]. attributes ["linenos" ]
271
+ assert cellinput1 .children [ 0 ]. attributes ["highlight_args" ]["linenostart" ] == 8
273
272
assert cellinput1 .children [0 ].rawsource .strip () == "3 + 3"
274
273
assert celloutput1 .children [0 ].rawsource .strip () == "6"
275
274
0 commit comments