Skip to content

Commit 2be8a1c

Browse files
committed
Speed up tests
1 parent 0573db3 commit 2be8a1c

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

test/functions_test.rb

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,16 @@ def test_collect_all
3232

3333
def test_map_batches
3434
df = Polars::DataFrame.new({"a" => [1, 2, 3], "b" => [4, 5, 6]})
35-
result =
36-
with_stress do
37-
df.select(Polars.struct(["a", "b"]).map_batches { |x| x.struct.field("a") + x.struct.field("b") + 1 })
38-
end
39-
assert_frame ({"a" => [6, 8, 10]}), result
35+
expr = Polars.struct(["a", "b"]).map_batches { |x| x.struct.field("a") + x.struct.field("b") + 1 }
36+
GC.start
37+
assert_frame ({"a" => [6, 8, 10]}), df.select(expr)
4038
end
4139

4240
def test_fold
4341
df = Polars::DataFrame.new({"a" => [1, 2, 3]})
44-
result =
45-
with_stress do
46-
df.select(Polars.fold(Polars.lit(1), ->(acc, x) { acc + x }, Polars.col("*")).alias("sum"))
47-
end
48-
assert_series [2, 3, 4], result["sum"]
42+
expr = Polars.fold(Polars.lit(1), ->(acc, x) { acc + x }, Polars.col("*"))
43+
GC.start
44+
assert_series [2, 3, 4], df.select(expr).to_series
4945
end
5046

5147
def test_min

0 commit comments

Comments
 (0)