Skip to content

Funding from sponcerships #287

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

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions test/scientist/experiment_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def @ex.enabled?
end

it "reports an error and returns the original value when an error is raised in a clean block" do
@ex.clean { |value| raise "kaboom" }
@ex.clean { |_value| raise "kaboom" }

@ex.use { "control" }
@ex.try { "candidate" }
Expand Down Expand Up @@ -328,7 +328,7 @@ def @ex.enabled?
it "rescues errors raised in the cohort determination block" do
@ex.use { 5670 }
@ex.try { 5670 }
@ex.cohort { |res| raise "intentional" }
@ex.cohort { |_res| raise "intentional" }

@ex.run

Expand Down Expand Up @@ -412,9 +412,9 @@ def @ex.enabled?

it "calls multiple ignore blocks to see if any match" do
called_one = called_two = called_three = false
@ex.ignore { |a, b| called_one = true; false }
@ex.ignore { |a, b| called_two = true; false }
@ex.ignore { |a, b| called_three = true; false }
@ex.ignore { |_a, _b| called_one = true; false }
@ex.ignore { |_a, _b| called_two = true; false }
@ex.ignore { |_a, _b| called_three = true; false }
refute @ex.ignore_mismatched_observation?(@a, @b)
assert called_one
assert called_two
Expand All @@ -423,9 +423,9 @@ def @ex.enabled?

it "only calls ignore blocks until one matches" do
called_one = called_two = called_three = false
@ex.ignore { |a, b| called_one = true; false }
@ex.ignore { |a, b| called_two = true; true }
@ex.ignore { |a, b| called_three = true; false }
@ex.ignore { |_a, _b| called_one = true; false }
@ex.ignore { |_a, _b| called_two = true; true }
@ex.ignore { |_a, _b| called_three = true; false }
assert @ex.ignore_mismatched_observation?(@a, @b)
assert called_one
assert called_two
Expand Down
2 changes: 1 addition & 1 deletion test/scientist/observation_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
end

it "doesn't clean nil values" do
@experiment.clean { |value| "foo" }
@experiment.clean { |_value| "foo" }
a = Scientist::Observation.new("test", @experiment) { nil }
assert_nil a.cleaned_value
end
Expand Down
4 changes: 2 additions & 2 deletions test/scientist/result_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
y = Scientist::Observation.new("y", @experiment) { :y }
z = Scientist::Observation.new("z", @experiment) { :z }

@experiment.ignore { |control, candidate| candidate == :y }
@experiment.ignore { |_control, candidate| candidate == :y }

result = Scientist::Result.new @experiment, [x, y, z], x

Expand All @@ -105,7 +105,7 @@
result = Scientist::Result.new @experiment, [a, b], a
assert_nil result.cohort

result = Scientist::Result.new @experiment, [a, b], a, ->(res) { "cohort-1" }
result = Scientist::Result.new @experiment, [a, b], a, ->(_res) { "cohort-1" }
assert_equal "cohort-1", result.cohort
end

Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy