File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -200,3 +200,42 @@ async def test_execute_async():
200200
201201 assert isinstance (result , ExpressionResult )
202202 assert result .value == 4
203+
204+
205+ def test_trailing_newlines_with_expression (shell ):
206+ code = """
207+ x = 5
208+ y = 10
209+ x + y
210+
211+
212+ """
213+ result = shell ._execute (code )
214+
215+ assert isinstance (result , ExpressionResult )
216+ assert result .value == 15
217+ assert "15" in result .output
218+
219+
220+ def test_trailing_whitespace_with_expression (shell ):
221+ code = "2 + 2 \n \n "
222+ result = shell ._execute (code )
223+
224+ assert isinstance (result , ExpressionResult )
225+ assert result .value == 4
226+
227+
228+ def test_leading_newlines_with_expression (shell ):
229+ code = "\n \n \n 2 + 2"
230+ result = shell ._execute (code )
231+
232+ assert isinstance (result , ExpressionResult )
233+ assert result .value == 4
234+
235+
236+ def test_expression_with_trailing_newlines (shell ):
237+ code = "x = 5\n x + 10\n \n "
238+ result = shell ._execute (code )
239+
240+ assert isinstance (result , ExpressionResult )
241+ assert result .value == 15
You can’t perform that action at this time.
0 commit comments