Skip to content

Commit

Permalink
Remove redundant assert_starts_with test helper (#13542)
Browse files Browse the repository at this point in the history
Replace with usage of `DataFusionError::strip_backtrace`.
  • Loading branch information
findepi authored Nov 24, 2024
1 parent b42cb8b commit bd47d4f
Showing 1 changed file with 12 additions and 23 deletions.
35 changes: 12 additions & 23 deletions datafusion/physical-plan/src/execution_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1098,9 +1098,9 @@ mod tests {
&vec![0],
);
assert!(result.is_err());
assert_starts_with(
result.err().unwrap().message().as_ref(),
"Invalid batch column at '0' has null but schema specifies non-nullable",
assert_eq!(
result.err().unwrap().strip_backtrace(),
"Execution error: Invalid batch column at '0' has null but schema specifies non-nullable",
);
Ok(())
}
Expand All @@ -1123,9 +1123,9 @@ mod tests {
&vec![0],
);
assert!(result.is_err());
assert_starts_with(
result.err().unwrap().message().as_ref(),
"Invalid batch column at '0' has null but schema specifies non-nullable",
assert_eq!(
result.err().unwrap().strip_backtrace(),
"Execution error: Invalid batch column at '0' has null but schema specifies non-nullable",
);
Ok(())
}
Expand All @@ -1147,9 +1147,9 @@ mod tests {
&vec![0],
);
assert!(result.is_err());
assert_starts_with(
result.err().unwrap().message().as_ref(),
"Invalid batch column at '0' has null but schema specifies non-nullable",
assert_eq!(
result.err().unwrap().strip_backtrace(),
"Execution error: Invalid batch column at '0' has null but schema specifies non-nullable",
);
Ok(())
}
Expand Down Expand Up @@ -1190,21 +1190,10 @@ mod tests {
&vec![0],
);
assert!(result.is_err());
assert_starts_with(
result.err().unwrap().message().as_ref(),
"Invalid batch column at '0' has null but schema specifies non-nullable",
assert_eq!(
result.err().unwrap().strip_backtrace(),
"Execution error: Invalid batch column at '0' has null but schema specifies non-nullable",
);
Ok(())
}

fn assert_starts_with(actual: impl AsRef<str>, expected_prefix: impl AsRef<str>) {
let actual = actual.as_ref();
let expected_prefix = expected_prefix.as_ref();
assert!(
actual.starts_with(expected_prefix),
"Expected '{}' to start with '{}'",
actual,
expected_prefix
);
}
}

0 comments on commit bd47d4f

Please sign in to comment.