Skip to content

Commit

Permalink
fix more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Oct 14, 2023
1 parent 8645f7d commit f0d05a7
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion crates/nano-arrow/src/array/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub fn offset_buffers_children_dictionary(array: &dyn Array) -> BuffersChildren
match array.data_type().to_physical_type() {
Null => ffi_dyn!(array, NullArray),
Boolean => ffi_dyn!(array, BooleanArray),
Primitive(primitive) => with_match_primitive_type!(primitive, |$T| {
Primitive(primitive) => with_match_primitive_type_full!(primitive, |$T| {
ffi_dyn!(array, PrimitiveArray<$T>)
}),
Binary => ffi_dyn!(array, BinaryArray<i32>),
Expand Down
4 changes: 2 additions & 2 deletions crates/nano-arrow/src/ffi/bridge.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::array::*;
use crate::{match_integer_type, with_match_primitive_type};
use crate::{match_integer_type, with_match_primitive_type_full};

macro_rules! ffi_dyn {
($array:expr, $ty:ty) => {{
Expand All @@ -17,7 +17,7 @@ pub fn align_to_c_data_interface(array: Box<dyn Array>) -> Box<dyn Array> {
match array.data_type().to_physical_type() {
Null => ffi_dyn!(array, NullArray),
Boolean => ffi_dyn!(array, BooleanArray),
Primitive(primitive) => with_match_primitive_type!(primitive, |$T| {
Primitive(primitive) => with_match_primitive_type_full!(primitive, |$T| {
ffi_dyn!(array, PrimitiveArray<$T>)
}),
Binary => ffi_dyn!(array, BinaryArray<i32>),
Expand Down
4 changes: 2 additions & 2 deletions crates/nano-arrow/src/io/ipc/read/deserialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use super::{Dictionaries, IpcBuffer, Node};
use crate::array::*;
use crate::datatypes::{DataType, Field, PhysicalType};
use crate::io::ipc::IpcField;
use crate::{match_integer_type, with_match_primitive_type};
use crate::{match_integer_type, with_match_primitive_type, with_match_primitive_type_full};

#[allow(clippy::too_many_arguments)]
pub fn read<R: Read + Seek>(
Expand Down Expand Up @@ -43,7 +43,7 @@ pub fn read<R: Read + Seek>(
scratch,
)
.map(|x| x.boxed()),
Primitive(primitive) => with_match_primitive_type!(primitive, |$T| {
Primitive(primitive) => with_match_primitive_type_full!(primitive, |$T| {
read_primitive::<$T, _>(
field_nodes,
data_type,
Expand Down
2 changes: 1 addition & 1 deletion py-polars/tests/unit/dataframe/test_df.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ def test_file_buffer() -> None:
f.write(b"1,2,3,4,5,6\n7,8,9,10,11,12")
f.seek(0)
# check if not fails on TryClone and Length impl in file.rs
with pytest.raises():
with pytest.raises(OSError):
pl.read_parquet(f)


Expand Down
2 changes: 1 addition & 1 deletion py-polars/tests/unit/datatypes/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_cast_list_array() -> None:

# width is incorrect
with pytest.raises(
pl.ArrowError,
pl.ComputeError,
match=r"incompatible offsets in source list",
):
s.cast(pl.Array(width=2, inner=pl.Int64))
Expand Down
2 changes: 1 addition & 1 deletion py-polars/tests/unit/datatypes/test_temporal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2177,7 +2177,7 @@ def test_replace_time_zone_ambiguous_with_use_earliest(
def test_replace_time_zone_ambiguous_raises() -> None:
ts = pl.Series(["2018-10-28 02:30:00"]).str.strptime(pl.Datetime)
with pytest.raises(
ArrowError, match="Please use `ambiguous` to tell how it should be localized"
pl.ComputeError, match="Please use `ambiguous` to tell how it should be localized"
):
ts.dt.replace_time_zone("Europe/Brussels")

Expand Down
2 changes: 1 addition & 1 deletion py-polars/tests/unit/functions/test_as_datatype.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_datetime_time_zone(time_zone: str | None) -> None:
def test_datetime_ambiguous_time_zone() -> None:
expr = pl.datetime(2018, 10, 28, 2, 30, time_zone="Europe/Brussels")

with pytest.raises(pl.ArrowError):
with pytest.raises(pl.InvalidOperationError):
pl.select(expr)


Expand Down
10 changes: 5 additions & 5 deletions py-polars/tests/unit/io/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ def test_to_from_buffer(
def test_to_from_buffer_lzo(df: pl.DataFrame) -> None:
buf = io.BytesIO()
# Writing lzo compressed parquet files is not supported for now.
with pytest.raises(pl.ArrowError):
with pytest.raises(pl.ComputeError):
df.write_parquet(buf, compression="lzo", use_pyarrow=False)
buf.seek(0)
# Invalid parquet file as writing failed.
with pytest.raises(pl.ArrowError):
with pytest.raises(pl.ComputeError):
_ = pl.read_parquet(buf)

buf = io.BytesIO()
Expand All @@ -102,7 +102,7 @@ def test_to_from_buffer_lzo(df: pl.DataFrame) -> None:
df.write_parquet(buf, compression="lzo", use_pyarrow=True)
buf.seek(0)
# Invalid parquet file as writing failed.
with pytest.raises(pl.ArrowError):
with pytest.raises(pl.ComputeError):
_ = pl.read_parquet(buf)


Expand All @@ -126,10 +126,10 @@ def test_to_from_file_lzo(df: pl.DataFrame, tmp_path: Path) -> None:
file_path = tmp_path / "small.avro"

# Writing lzo compressed parquet files is not supported for now.
with pytest.raises(pl.ArrowError):
with pytest.raises(pl.ComputeError):
df.write_parquet(file_path, compression="lzo", use_pyarrow=False)
# Invalid parquet file as writing failed.
with pytest.raises(pl.ArrowError):
with pytest.raises(pl.ComputeError):
_ = pl.read_parquet(file_path)

# Writing lzo compressed parquet files is not supported for now.
Expand Down

0 comments on commit f0d05a7

Please sign in to comment.