Skip to content

Apache DataFusion SQL Query Engine

Remove redundant assert_starts_with test helper (#13542)

Piotr Findeisenbd47d4f7db6e
diff --git a/datafusion/physical-plan/src/execution_plan.rs b/datafusion/physical-plan/src/execution_plan.rs
index 7220e7594e..4b91cfff06 100644
--- a/datafusion/physical-plan/src/execution_plan.rs
+++ b/datafusion/physical-plan/src/execution_plan.rs
@@ -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(())
}
@@ -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(())
}
@@ -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(())
}
@@ -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
- );
- }
}