Skip to content
Merged
Changes from all 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
5 changes: 4 additions & 1 deletion spec/pycall/pyobject_wrapper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,11 @@ module PyCall
list = PyCall::List.new([*1..10])
expect(list[(1..-1).step(2)]).to eq(PyCall::List.new([2, 4, 6, 8, 10]))
expect(list[(1..-2).step(2)]).to eq(PyCall::List.new([2, 4, 6, 8]))
expect(list[(nil..nil).step(-1)]).to eq(PyCall::List.new([*1..10].reverse))
expect(list[(-1..0).step(-1)]).to eq(PyCall::List.new([*1..10].reverse))
# In Ruby 3.4+, step for non-numeric beginless ranges raises ArgumentError
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.4.0')
expect(list[(nil..nil).step(-1)]).to eq(PyCall::List.new([*1..10].reverse))
end
expect(list[(-1...0).step(-1)]).to eq(PyCall::List.new([*2..10].reverse))
expect(list[(-2..2).step(-2)]).to eq(PyCall::List.new([9, 7, 5, 3]))
expect(list[(-2...2).step(-2)]).to eq(PyCall::List.new([9, 7, 5]))
Expand Down
Loading