Skip to content

Commit

Permalink
fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
igrigorik committed Nov 24, 2015
1 parent 4811a51 commit 7b034dc
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions spec/id3_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
end
Given(:tree) { DecisionTree::ID3Tree.new(labels, data, 1, :discrete) }
When { tree.train }
Then { tree.predict([1,0]).should == 1 }
Then { tree.predict([0,1]).should == 0 }
Then { expect(tree.predict([1,0])).to eq 1 }
Then { expect(tree.predict([0,1])).to eq 0 }
end

describe "discrete attributes" do
Expand All @@ -28,8 +28,8 @@
end
Given(:tree) { DecisionTree::ID3Tree.new(labels, data, "not angry", :discrete) }
When { tree.train }
Then { tree.predict(["yes", "red"]).should == "angry" }
Then { tree.predict(["no", "red"]).should == "not angry" }
Then { expect(tree.predict(["yes", "red"])).to eq "angry" }
Then { expect(tree.predict(["no", "red"])).to eq "not angry" }
end

describe "discrete attributes" do
Expand All @@ -48,8 +48,8 @@
end
Given(:tree) { DecisionTree::ID3Tree.new(labels, data, "not angry", :continuous) }
When { tree.train }
Then { tree.predict([7, 7]).should == "angry" }
Then { tree.predict([2, 3]).should == "not angry" }
Then { expect(tree.predict([7, 7])).to eq "angry" }
Then { expect(tree.predict([2, 3])).to eq "not angry" }
end

describe "a mixture" do
Expand All @@ -68,8 +68,8 @@
end
Given(:tree) { DecisionTree::ID3Tree.new(labels, data, "not angry", color: :discrete, hunger: :continuous) }
When { tree.train }
Then { tree.predict([7, "red"]).should == "angry" }
Then { tree.predict([2, "blue"]).should == "not angry" }
Then { expect(tree.predict([7, "red"])).to eq "angry" }
Then { expect(tree.predict([2, "blue"])).to eq "not angry" }
end

describe "infinite recursion case" do
Expand All @@ -84,7 +84,7 @@
end
Given(:tree) { DecisionTree::ID3Tree.new(labels, data, "RED", :discrete) }
When { tree.train }
Then { tree.predict(["a1","b0","c0"]).should == "RED" }
Then { expect(tree.predict(["a1","b0","c0"])).to eq "RED" }
end

describe "numerical labels case" do
Expand All @@ -100,7 +100,7 @@
Given(:tree) { DecisionTree::ID3Tree.new labels, data, nil, :discrete }
When { tree.train }
Then {
lambda { tree.predict([1, 1]) }.should_not raise_error
expect { tree.predict([1, 1]) }.to_not raise_error
}
end

Expand Down

0 comments on commit 7b034dc

Please sign in to comment.