kz930 commented on code in PR #8504:
URL: https://github.com/apache/texera/pull/8504#discussion_r4255100297


##########
common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/carpetPlot/CarpetPlotOpDescSpec.scala:
##########
@@ -75,4 +149,89 @@ class CarpetPlotOpDescSpec extends AnyFlatSpec with 
Matchers {
     c.b shouldBe "bx"
     c.y shouldBe "yx"
   }
+
+  // Runs the exported block over one frame per case and reports the page it
+  // wrote, so a branch that raises instead of answering shows up as a failure
+  // rather than as a missing file.
+  private val driverScript: String =
+    """import pathlib
+      |import sys
+      |import tempfile
+      |
+      |import pandas as pd
+      |import plotly.graph_objects as go
+      |
+      |source = pathlib.Path(sys.argv[1]).read_text()
+      |
+      |cases = {
+      |    "good": pd.DataFrame({"ax": [1.0, 2.0], "bx": [1.0, 2.0], "yx": 
[3.0, 4.0]}),
+      |    "missing": pd.DataFrame({"ax": [1.0], "yx": [3.0]}),
+      |    "words": pd.DataFrame({"ax": ["one", "two"], "bx": [1.0, 2.0], 
"yx": [3.0, 4.0]}),
+      |    "empty": pd.DataFrame({"ax": [], "bx": [], "yx": []}),
+      |    "nulls": pd.DataFrame({"ax": [None, None], "bx": [1.0, 2.0], "yx": 
[3.0, 4.0]}),
+      |}
+      |
+      |for name, frame in cases.items():
+      |    directory = tempfile.mkdtemp()
+      |    scope = {
+      |        "in1df": frame,
+      |        "outputHtml": directory + "/chart.html",
+      |        "outputJson": directory + "/chart.json",
+      |        "pd": pd,
+      |        "go": go,
+      |    }
+      |    exec(compile(source, "standalone", "exec"), scope)
+      |    # An answer page is the whole file and opens with the heading, 
where a
+      |    # chart is a plotly document that happens to contain any wording.
+      |    page = pathlib.Path(scope["outputHtml"]).read_text().strip()

Review Comment:
   Thanks, reproduced by reading a Plotly page as cp1252. Both drivers now read 
the module and the page with `encoding="utf-8"`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to