@@ -56,7 +56,7 @@ describe("Running the code with pyodide", () => {
5656
5757 it ( "interrupts the code when the stop button is clicked" , ( ) => {
5858 runCode (
59- "from time import sleep\nfor i in range(100):\n\tprint(i)\n\tsleep(1)"
59+ "from time import sleep\nfor i in range(100):\n\tprint(i)\n\tsleep(1)" ,
6060 ) ;
6161 cy . get ( "editor-wc" )
6262 . shadow ( )
@@ -115,7 +115,7 @@ describe("Running the code with pyodide", () => {
115115 . find ( ".error-message__content" )
116116 . should (
117117 "contain" ,
118- "FileExistsError: File 'output.txt' already exists on line 1 of main.py"
118+ "FileExistsError: File 'output.txt' already exists on line 1 of main.py" ,
119119 ) ;
120120 } ) ;
121121
@@ -126,7 +126,7 @@ describe("Running the code with pyodide", () => {
126126 . find ( "div[class=cm-content]" )
127127 . invoke (
128128 "text" ,
129- 'with open("output.txt", "a") as f:\n\tf.write("Hello again world")'
129+ 'with open("output.txt", "a") as f:\n\tf.write("Hello again world")' ,
130130 ) ;
131131 cy . get ( "editor-wc" )
132132 . shadow ( )
@@ -153,7 +153,7 @@ describe("Running the code with pyodide", () => {
153153
154154 it ( "runs a simple program with a built-in pyodide module" , ( ) => {
155155 runCode (
156- "import simplejson as json\nprint(json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]))"
156+ "import simplejson as json\nprint(json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]))" ,
157157 ) ;
158158 cy . get ( "editor-wc" )
159159 . shadow ( )
@@ -163,7 +163,7 @@ describe("Running the code with pyodide", () => {
163163
164164 it ( "runs a simple pygal program" , ( ) => {
165165 runCode (
166- "import pygal\nbar_chart = pygal.Bar()\nbar_chart.add('Fibonacci', [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55])\nbar_chart.render()"
166+ "import pygal\nbar_chart = pygal.Bar()\nbar_chart.add('Fibonacci', [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55])\nbar_chart.render()" ,
167167 ) ;
168168 cy . get ( "editor-wc" )
169169 . shadow ( )
@@ -173,7 +173,7 @@ describe("Running the code with pyodide", () => {
173173
174174 it ( "runs a simple matplotlib program" , ( ) => {
175175 runCode (
176- "import matplotlib.pyplot as plt\nx = [1,2,3]\ny = [2,4,1]\nplt.plot(x, y)\nplt.title('My first graph!')\nplt.show()"
176+ "import matplotlib.pyplot as plt\nx = [1,2,3]\ny = [2,4,1]\nplt.plot(x, y)\nplt.title('My first graph!')\nplt.show()" ,
177177 ) ;
178178 cy . wait ( 5000 ) ;
179179 cy . get ( "editor-wc" )
@@ -193,12 +193,24 @@ describe("Running the code with pyodide", () => {
193193 . should ( "be.visible" ) ;
194194 } ) ;
195195
196+ it ( "runs a simple plotly program" , ( ) => {
197+ runCode (
198+ 'import plotly.express as px\ndf = px.data.gapminder().query("country==\'Canada\'")\nfig = px.line(df, x="year", y="lifeExp", title=\'Life expectancy in Canada\')\nfig.show()' ,
199+ ) ;
200+ cy . wait ( 3000 ) ;
201+ cy . get ( "editor-wc" )
202+ . shadow ( )
203+ . find ( ".pyodiderunner" )
204+ . find ( "div.js-plotly-plot" )
205+ . should ( "be.visible" ) ;
206+ } ) ;
207+
196208 it ( "runs a simple urllib program" , ( ) => {
197209 cy . intercept ( "GET" , "https://www.my-amazing-website.com" , {
198210 statusCode : 200 ,
199211 } ) ;
200212 runCode (
201- "import urllib.request\nresponse = urllib.request.urlopen('https://www.my-amazing-website.com')\nprint(response.getcode())"
213+ "import urllib.request\nresponse = urllib.request.urlopen('https://www.my-amazing-website.com')\nprint(response.getcode())" ,
202214 ) ;
203215 cy . get ( "editor-wc" )
204216 . shadow ( )
@@ -208,7 +220,7 @@ describe("Running the code with pyodide", () => {
208220
209221 it ( "runs a simple program with a module from PyPI" , ( ) => {
210222 runCode (
211- "from strsimpy.levenshtein import Levenshtein\nlevenshtein = Levenshtein()\nprint(levenshtein.distance('hello', 'world'))"
223+ "from strsimpy.levenshtein import Levenshtein\nlevenshtein = Levenshtein()\nprint(levenshtein.distance('hello', 'world'))" ,
212224 ) ;
213225 cy . get ( "editor-wc" )
214226 . shadow ( )
@@ -236,7 +248,7 @@ text_in = "This is a test message"
236248rotor_start = "FNZ"
237249text_out = use_enigma_machine(text_in, rotor_start)
238250print(text_out)
239- `
251+ ` ,
240252 ) ;
241253 cy . get ( "editor-wc" )
242254 . shadow ( )
@@ -251,7 +263,7 @@ print(text_out)
251263 . find ( ".error-message__content" )
252264 . should (
253265 "contain" ,
254- "ModuleNotFoundError: No module named 'i_do_not_exist' on line 1 of main.py"
266+ "ModuleNotFoundError: No module named 'i_do_not_exist' on line 1 of main.py" ,
255267 ) ;
256268 } ) ;
257269
0 commit comments