Skip to content

Commit

Permalink
Adding error message to date repeat (#149)
Browse files Browse the repository at this point in the history
Liniting fixes
  • Loading branch information
Bidek56 authored Jan 10, 2024
1 parent 6570666 commit b66aa2a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions __tests__/functions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ describe("concat", () => {
});
it("cant concat empty list", () => {
const fn = () => pl.concat([]);
expect(fn).toThrowError();
expect(fn).toThrow();
});

it("can only concat series and df", () => {
const fn = () => pl.concat([[1] as any, [2] as any]);
expect(fn).toThrowError();
expect(fn).toThrow();
});
test("horizontal concat", () => {
const a = pl.DataFrame({ a: ["a", "b"], b: [1, 2] });
Expand Down Expand Up @@ -75,6 +75,10 @@ describe("repeat", () => {

expect(actual).toSeriesEqual(expected);
});
it("fail to repeat a date value", () => {
const fn = () => pl.repeat(new Date(), 4, "foo");
expect(fn).toThrow();
});
});
describe("horizontal", () => {
it("compute the bitwise AND horizontally across columns.", () => {
Expand Down
4 changes: 2 additions & 2 deletions __tests__/series.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,10 +546,10 @@ describe("series", () => {
}
});
it("describe", () => {
expect(() => pl.Series([]).describe()).toThrowError(
expect(() => pl.Series([]).describe()).toThrow(
"Series must contain at least one value",
);
expect(() => pl.Series("dt", [null], pl.Date).describe()).toThrowError(
expect(() => pl.Series("dt", [null], pl.Date).describe()).toThrow(
"Invalid operation: describe is not supported for DataType(Date)",
);
let actual = pl.Series([true, false, true]).describe();
Expand Down
2 changes: 1 addition & 1 deletion src/series.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ impl JsSeries {
));
}
}
_ => todo!(),
dt => { return Err(napi::Error::from_reason(format!("data type: {:?} is not supported as range", dt))); }
};
Ok(s)
}
Expand Down

0 comments on commit b66aa2a

Please sign in to comment.