

def test_take_while(self, space):
    w_res = space.execute('return (1..10).take_while { |i| i < 4 }')
    assert (self.unwrap(space, w_res) == [1, 2, 3])
    w_res = space.execute('return [].take_while { |i| i == 11 }')
    assert (self.unwrap(space, w_res) == [])
    w_res = space.execute('return (1..10).take_while { |i| i > 11 }')
    assert (self.unwrap(space, w_res) == [])
    w_res = space.execute('return (1..10).take_while { |i| i < 11 }')
    assert (self.unwrap(space, w_res) == range(1, 11))

dataset/ETHPy150Open topazproject/topaz/tests/modules/test_enumerable.py TestEnumberable.test_take_while/original