Skip to content

Commit 854ce39

Browse files
committed
fix: re-add test_utils module
1 parent 29bca8f commit 854ce39

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
mod python;
22
mod rust;
3+
mod test_utils;

host/tests/integration_tests/python/runtime/http.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ use tokio::runtime::Handle;
1717
use wasmtime_wasi_http::types::DEFAULT_FORBIDDEN_HEADERS;
1818
use wiremock::{Mock, MockServer, ResponseTemplate, matchers};
1919

20-
use crate::integration_tests::python::test_utils::{python_component, python_scalar_udf};
20+
use crate::integration_tests::{
21+
python::test_utils::{python_component, python_scalar_udf},
22+
test_utils::ColumnarValueExt,
23+
};
2124

2225
#[tokio::test(flavor = "multi_thread")]
2326
async fn test_requests_simple() {
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use arrow::array::ArrayRef;
2+
use datafusion_expr::ColumnarValue;
3+
4+
/// Extension trait for [`ColumnarValue`] for easier testing.
5+
pub(crate) trait ColumnarValueExt {
6+
/// Extracts [`ColumnarValue::Array`] variant.
7+
///
8+
/// # Panic
9+
/// Panics if this is not an array.
10+
#[track_caller]
11+
fn unwrap_array(self) -> ArrayRef;
12+
}
13+
14+
impl ColumnarValueExt for ColumnarValue {
15+
#[track_caller]
16+
fn unwrap_array(self) -> ArrayRef {
17+
match self {
18+
Self::Array(array) => array,
19+
Self::Scalar(_) => panic!("expected an array but got a scalar"),
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)