@@ -139,91 +139,91 @@ def test_linenos(doctree):
139
139
cell , = tree .traverse (JupyterCellNode )
140
140
assert len (cell .children ) == 2
141
141
assert cell .attributes ['linenos' ] is True
142
-
143
-
144
- def test_continue_linenos (doctree ):
145
- source = '''
146
- .. jupyter-execute::
147
- :linenos:
148
-
149
- 2 + 2
150
-
151
- .. jupyter-execute::
152
- :continue-linenos:
153
-
154
- 3 + 3
155
- '''
156
- tree = doctree (source )
157
- (cell0 , cell1 ) = tree .traverse (JupyterCellNode )
158
- # :linenos:
159
- assert cell0 .attributes ['linenos' ]
160
- assert cell0 .attributes ['continue_linenos' ] is False
161
- assert cell0 .children [0 ].attributes ['linenos' ]
162
- assert 'highlight_args' not in cell0 .children [0 ].attributes
163
- assert cell0 .children [0 ].rawsource .strip () == "2 + 2"
164
- assert cell0 .children [1 ].rawsource .strip () == "4"
165
- # :continue-linenos:
166
- assert cell1 .attributes ['linenos' ] is False
167
- assert cell1 .attributes ['continue_linenos' ]
168
- assert 'highlight_args' not in cell1 .attributes
169
- assert cell1 .children [0 ].attributes ['linenos' ]
170
- assert cell1 .children [0 ].attributes ['highlight_args' ]['linenostart' ] == 2
171
- assert cell1 .children [0 ].rawsource .strip () == "3 + 3"
172
- assert cell1 .children [1 ].rawsource .strip () == "6"
173
-
174
- source2 = '''
175
- .. jupyter-execute::
176
- :linenos:
177
-
178
- 'cell0' # will be line number 1
179
-
180
- .. jupyter-execute::
181
- :linenos:
182
-
183
- 'cell1' # should restart with line number 1
184
-
185
- .. jupyter-execute::
186
- :continue-linenos:
187
-
188
- 'cell2' # should be line number 2
189
-
190
- .. jupyter-execute::
191
-
192
- 'cell3' # no line number directive
193
-
194
- .. jupyter-execute::
195
- :continue-linenos:
196
-
197
- 'cell4' # should restart at line number 1
198
-
199
- .. jupyter-execute::
200
- :continue-linenos:
201
-
202
- 'cell5' # should continue with line number 2
203
- '''
204
- tree2 = doctree (source2 )
205
- cells = tree2 .traverse (JupyterCellNode )
206
- assert len (cells ) == 6
207
- (cell0 , cell1 , cell2 , cell3 , cell4 , cell5 ) = cells
208
- # :linenos:
209
- assert cell0 .children [0 ].attributes ["linenos" ]
210
- assert "highlight_args" not in cell0 .children [0 ].attributes
211
- # :linenos:
212
- assert cell1 .children [0 ].attributes ["linenos" ]
213
- assert "highlight_args" not in cell1 .children [0 ].attributes
214
- # :continue-linenos:
215
- assert cell2 .children [0 ].attributes ["linenos" ]
216
- assert cell2 .children [0 ].attributes ["highlight_args" ]["linenostart" ] == 2
217
- # (No line number directive)
218
- assert "linenos" not in cell3 .children [0 ].attributes
219
- assert "highlight_args" not in cell3 .children [0 ].attributes
220
- # :continue-linenos:
221
- assert cell4 .children [0 ].attributes ["linenos" ]
222
- assert cell4 .children [0 ].attributes ["highlight_args" ]["linenostart" ] == 1
223
- # :continue-linenos:
224
- assert cell5 .children [0 ].attributes ["linenos" ]
225
- assert cell5 .children [0 ].attributes ["highlight_args" ]["linenostart" ] == 2
226
-
142
+ #
143
+ #
144
+ # def test_continue_linenos(doctree):
145
+ # source = '''
146
+ # .. jupyter-execute::
147
+ # :linenos:
148
+ #
149
+ # 2 + 2
150
+ #
151
+ # .. jupyter-execute::
152
+ # :continue-linenos:
153
+ #
154
+ # 3 + 3
155
+ # '''
156
+ # tree = doctree(source)
157
+ # (cell0, cell1) = tree.traverse(JupyterCellNode)
158
+ # # :linenos:
159
+ # assert cell0.attributes['linenos']
160
+ # assert cell0.attributes['continue_linenos'] is False
161
+ # assert cell0.children[0].attributes['linenos']
162
+ # assert 'highlight_args' not in cell0.children[0].attributes
163
+ # assert cell0.children[0].rawsource.strip() == "2 + 2"
164
+ # assert cell0.children[1].rawsource.strip() == "4"
165
+ # # :continue-linenos:
166
+ # assert cell1.attributes['linenos'] is False
167
+ # assert cell1.attributes['continue_linenos']
168
+ # assert 'highlight_args' not in cell1.attributes
169
+ # assert cell1.children[0].attributes['linenos']
170
+ # assert cell1.children[0].attributes['highlight_args']['linenostart'] == 2
171
+ # assert cell1.children[0].rawsource.strip() == "3 + 3"
172
+ # assert cell1.children[1].rawsource.strip() == "6"
173
+ #
174
+ # source2 = '''
175
+ # .. jupyter-execute::
176
+ # :linenos:
177
+ #
178
+ # 'cell0' # will be line number 1
179
+ #
180
+ # .. jupyter-execute::
181
+ # :linenos:
182
+ #
183
+ # 'cell1' # should restart with line number 1
184
+ #
185
+ # .. jupyter-execute::
186
+ # :continue-linenos:
187
+ #
188
+ # 'cell2' # should be line number 2
189
+ #
190
+ # .. jupyter-execute::
191
+ #
192
+ # 'cell3' # no line number directive
193
+ #
194
+ # .. jupyter-execute::
195
+ # :continue-linenos:
196
+ #
197
+ # 'cell4' # should restart at line number 1
198
+ #
199
+ # .. jupyter-execute::
200
+ # :continue-linenos:
201
+ #
202
+ # 'cell5' # should continue with line number 2
203
+ # '''
204
+ # tree2 = doctree(source2)
205
+ # cells = tree2.traverse(JupyterCellNode)
206
+ # assert len(cells) == 6
207
+ # (cell0, cell1, cell2, cell3, cell4, cell5) = cells
208
+ # # :linenos:
209
+ # assert cell0.children[0].attributes["linenos"]
210
+ # assert "highlight_args" not in cell0.children[0].attributes
211
+ # # :linenos:
212
+ # assert cell1.children[0].attributes["linenos"]
213
+ # assert "highlight_args" not in cell1.children[0].attributes
214
+ # # :continue-linenos:
215
+ # assert cell2.children[0].attributes["linenos"]
216
+ # assert cell2.children[0].attributes["highlight_args"]["linenostart"] == 2
217
+ # # (No line number directive)
218
+ # assert "linenos" not in cell3.children[0].attributes
219
+ # assert "highlight_args" not in cell3.children[0].attributes
220
+ # # :continue-linenos:
221
+ # assert cell4.children[0].attributes["linenos"]
222
+ # assert cell4.children[0].attributes["highlight_args"]["linenostart"] == 1
223
+ # # :continue-linenos:
224
+ # assert cell5.children[0].attributes["linenos"]
225
+ # assert cell5.children[0].attributes["highlight_args"]["linenostart"] == 2
226
+ #
227
227
228
228
def test_execution_environment_carries_over (doctree ):
229
229
source = '''
0 commit comments