You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "HyukjinKwon (via GitHub)" <gi...@apache.org> on 2023/07/28 05:46:00 UTC

[GitHub] [spark] HyukjinKwon commented on a diff in pull request #42196: Improve assertDataFrameEqual error message format

HyukjinKwon commented on code in PR #42196:
URL: https://github.com/apache/spark/pull/42196#discussion_r1277112278


##########
python/pyspark/testing/utils.py:
##########
@@ -189,6 +190,39 @@ def search_jar(project_relative_path, sbt_jar_name_prefix, mvn_jar_name_prefix):
         return jars[0]
 
 
+def _context_diff(actual: List[str], expected: List[str], n: int = 3):
+    """
+    Modified from difflib context_diff API,
+    see original code here: https://github.com/python/cpython/blob/main/Lib/difflib.py#L1180
+    """
+    def red(s: str) -> str:
+        RedColor = "\033[31m"
+        NoColor = "\033[0m"
+        return RedColor + str(s) + NoColor

Review Comment:
   ```suggestion
           red_color = "\033[31m"
           no_color = "\033[0m"
           return red_color + str(s) + no_color
   ```



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org