Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
happytomatoe committed Sep 2, 2024
1 parent 267f9ab commit bfddcbb
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ object DataframeUtil {
else {
val withEquals = actualSeq
.zip(expectedSeq)
.map { case (actualRowField, expectedRowField) => (actualRowField, expectedRowField, actualRowField == expectedRowField) }
.map { case (actualRowField, expectedRowField) =>
(actualRowField, expectedRowField, actualRowField == expectedRowField) }
val allFieldsAreNotEqual = !withEquals.exists(_._3)
if (allFieldsAreNotEqual) {
List(
Expand All @@ -43,10 +44,11 @@ object DataframeUtil {
} else {

val coloredDiff = withEquals
.map { case (actualRowField, expectedRowField, equal) =>
if (equal)
.map {
case (actualRowField, expectedRowField, true) =>
(DarkGray(actualRowField.toString), DarkGray(expectedRowField.toString))
else (Red(actualRowField.toString), Green(expectedRowField.toString))
case (actualRowField, expectedRowField, false) =>
(Red(actualRowField.toString), Green(expectedRowField.toString))
}
val start = DarkGray("[")
val sep = DarkGray(",")
Expand Down

0 comments on commit bfddcbb

Please sign in to comment.