Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Series.from_list/2 bugs #826

Closed
wants to merge 13 commits into from
Prev Previous commit
Next Next commit
Merge branch 'main' into from_list_u64
  • Loading branch information
lkarthee committed Jan 19, 2024
commit b7f90f7ee112fa41d8b34d5d3080ee78bf43be7e
7 changes: 7 additions & 0 deletions test/explorer/series_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
assert Series.dtype(s) == {:s, 64}
end

test "with u64 integers" do

Check failure on line 54 in test/explorer/series_test.exs

View workflow job for this annotation

GitHub Actions / test (26.2.1, 1.16)

test from_list/1 with u64 integers (Explorer.SeriesTest)
s = Series.from_list([9_223_372_036_854_775_808])

assert Series.to_list(s) === [9_223_372_036_854_775_808]
Expand All @@ -65,7 +65,7 @@
assert Series.dtype(s) == {:u, 64}
end

test "with integers (u64 at start)" do

Check failure on line 68 in test/explorer/series_test.exs

View workflow job for this annotation

GitHub Actions / test (25.3, 1.14)

test from_list/1 with integers (u64 at start) (Explorer.SeriesTest)
s = Series.from_list([9_223_372_036_854_775_808, 1, 2, 3])

assert Series.to_list(s) === [9_223_372_036_854_775_808, 1, 2, 3]
Expand All @@ -86,7 +86,7 @@
assert Series.dtype(s) == {:f, 64}
end

test "signed integers with dtype u64 - raises error" do

Check failure on line 89 in test/explorer/series_test.exs

View workflow job for this annotation

GitHub Actions / test (26.2.1, 1.16)

test from_list/1 signed integers with dtype u64 - raises error (Explorer.SeriesTest)
assert_raise ArgumentError,
"the value -1 does not match the inferred dtype {:u, 64}",
fn ->
Expand All @@ -94,7 +94,7 @@
end
end

test "signed integers and u64 - raises error" do

Check failure on line 97 in test/explorer/series_test.exs

View workflow job for this annotation

GitHub Actions / test (26.2.1, 1.16)

test from_list/1 signed integers and u64 - raises error (Explorer.SeriesTest)
assert_raise ArgumentError,
"the value 9223372036854775808 does not match the inferred dtype {:s, 64}",
fn ->
Expand All @@ -102,7 +102,7 @@
end
end

test "s16 integers with dtype s8 - raises error" do

Check failure on line 105 in test/explorer/series_test.exs

View workflow job for this annotation

GitHub Actions / test (25.3, 1.14)

test from_list/1 s16 integers with dtype s8 - raises error (Explorer.SeriesTest)
assert_raise ArgumentError,
"the value 32767 does not match the inferred dtype {:s, 8}",
fn ->
Expand Down Expand Up @@ -132,7 +132,7 @@
end
end

test "u16 integers with dtype u8 - raises error" do

Check failure on line 135 in test/explorer/series_test.exs

View workflow job for this annotation

GitHub Actions / test (26.2.1, 1.16)

test from_list/1 u16 integers with dtype u8 - raises error (Explorer.SeriesTest)
assert_raise ArgumentError,
"the value 32768 does not match the inferred dtype {:u, 8}",
fn ->
Expand All @@ -142,7 +142,7 @@
end
end

test "u32 integers with dtype u16 - raises error" do

Check failure on line 145 in test/explorer/series_test.exs

View workflow job for this annotation

GitHub Actions / test (25.3, 1.14)

test from_list/1 u32 integers with dtype u16 - raises error (Explorer.SeriesTest)
assert_raise ArgumentError,
"the value 9223372036854775807 does not match the inferred dtype {:u, 16}",
fn ->
Expand All @@ -162,7 +162,7 @@
end
end

test "u64 integers with dtype s64 - raises error" do

Check failure on line 165 in test/explorer/series_test.exs

View workflow job for this annotation

GitHub Actions / test (25.3, 1.14)

test from_list/1 u64 integers with dtype s64 - raises error (Explorer.SeriesTest)
assert_raise ArgumentError,
"the value 9223372036854775808 does not match the inferred dtype {:s, 64}",
fn ->
Expand All @@ -172,6 +172,13 @@
end
end

test "with unsigned integers" do
s = Series.from_list([1, 2, 3], dtype: {:u, 64})

assert Series.to_list(s) === [1, 2, 3]
assert Series.dtype(s) == {:u, 64}
end

test "with floats" do
s = Series.from_list([1, 2.4, 3])
assert Series.to_list(s) === [1.0, 2.4, 3.0]
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.