carloea2 commented on code in PR #8359:
URL: https://github.com/apache/texera/pull/8359#discussion_r3973979350


##########
workflow-compiling-service/src/test/scala/org/apache/texera/amber/translator/verify/VisualizationHtmlComparator.scala:
##########
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.texera.amber.translator.verify
+
+import org.apache.texera.amber.util.JSONUtils.objectMapper
+
+import java.nio.charset.StandardCharsets
+import java.nio.file.{Files, Path}
+
+object VisualizationHtmlComparator {
+
+  /** A pandas Styler namespaces its CSS with a uuid drawn per Styler 
instance, so
+    * the same table rendered twice differs in every `id=` and every selector 
even
+    * though the markup is identical. The uuid carries no information about the
+    * table — it only keeps two tables on one page from colliding — so it is
+    * normalized away before comparing. Only the random prefix is replaced: the
+    * `_row0_col0` suffix that identifies the cell stays, so a genuine 
structural
+    * difference still fails.
+    */
+  private val StylerUuid = "T_[0-9a-f]+".r
+
+  private def normalize(html: String): String = StylerUuid.replaceAllIn(html, 
"T_uuid")
+

Review Comment:
   This reports different output on Windows when only line endings differ. Five 
operator cases failed locally, including NestedTable and RadarChart. The JSONL 
HTML contains LF, while Python's text file output contains CRLF; after 
normalizing line endings and the existing Styler IDs, all five pairs are 
identical. Please normalize line endings before comparing.



-- 
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