Skip to content
Permalink
Browse files

small style cleanups

  • Loading branch information
Alex Gaynor committed Mar 12, 2013
1 parent 04d2f91 commit e6915987c8cf11b6340ae564d7aaa7e2c10259a4
Showing with 14 additions and 14 deletions.
  1. +14 −14 tests/modules/test_enumerable.py
@@ -95,8 +95,8 @@ def test_include(self, space):
assert w_res is space.w_true

def test_drop(self, space):
w_res = space.execute("""return [0,1,2,3,4,5,6,7].drop 3""")
assert self.unwrap(space, w_res) == [3,4,5,6,7]
w_res = space.execute("""return [0, 1, 2, 3, 4, 5, 6, 7].drop 3""")
assert self.unwrap(space, w_res) == [3, 4, 5, 6, 7]

w_res = space.execute("""return [].drop 3""")
assert self.unwrap(space, w_res) == []
@@ -105,7 +105,7 @@ def test_drop(self, space):
assert self.unwrap(space, w_res) == []

with self.raises(space, "ArgumentError", 'attempt to drop negative size'):
space.execute("""return [0,1,2,3,4,5,6,7].drop -3""")
space.execute("""return [0, 1, 2, 3, 4, 5, 6, 7].drop -3""")

def test_drop_while(self, space):
w_res = space.execute("""return [1, 2, 3, 4, 5, 0].drop_while { |i| i < 3 }""")
@@ -121,8 +121,8 @@ def test_to_a(self, space):
w_res = space.execute("""return (5..10).to_a""")
assert self.unwrap(space, w_res) == [x for x in range(5, 11)]

w_res = space.execute("""return [1,2,3,4].to_a""")
assert self.unwrap(space, w_res) == [1,2,3,4]
w_res = space.execute("""return [1, 2, 3, 4].to_a""")
assert self.unwrap(space, w_res) == [1, 2, 3, 4]

w_res = space.execute("""
class A
@@ -137,7 +137,7 @@ def each
end
end
return A.new.to_a""")
assert self.unwrap(space, w_res) == [0,1,2,3,4]
assert self.unwrap(space, w_res) == [0, 1, 2, 3, 4]

def test_detect(self, space):
w_res = space.execute("return (1..10).detect { |i| i == 11 }")
@@ -148,15 +148,15 @@ def test_detect(self, space):
assert space.int_w(w_res) == 5

def test_map(self, space):
w_res = space.execute("return [1,2,3,4,5].map { |i| i + 1 }")
assert self.unwrap(space, w_res) == [x for x in range(2, 7)]
w_res = space.execute("return [1,2,3,4,5].collect { |i| i + 1 }")
assert self.unwrap(space, w_res) == [x for x in range(2, 7)]
w_res = space.execute("return [1, 2, 3, 4, 5].map { |i| i + 1 }")
assert self.unwrap(space, w_res) == range(2, 7)
w_res = space.execute("return [1, 2, 3, 4, 5].collect { |i| i + 1 }")
assert self.unwrap(space, w_res) == range(2, 7)

def test_take(self, space):
w_res = space.execute("return [1,2,3,4,5].take(2)")
w_res = space.execute("return [1, 2, 3, 4, 5].take(2)")
assert self.unwrap(space, w_res) == [1, 2]
w_res = space.execute("return [1,2,3,4,5].take(0)")
w_res = space.execute("return [1, 2, 3, 4, 5].take(0)")
assert self.unwrap(space, w_res) == []
w_res = space.execute("return [].take(2)")
assert self.unwrap(space, w_res) == []
@@ -169,14 +169,14 @@ def test_take_while(self, space):
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) == [x for x in range(1, 11)]
assert self.unwrap(space, w_res) == range(1, 11)

def test_reject(self, space):
w_res = space.execute("return [1, 2, 3].reject { |i| i == 3 }")
assert self.unwrap(space, w_res) == [1, 2]
w_res = space.execute("return [].reject { |i| i == 3 }")
assert self.unwrap(space, w_res) == []
w_res = space.execute("return (1..10).reject { |i| i > 11 }")
assert self.unwrap(space, w_res) == [x for x in range(1, 11)]
assert self.unwrap(space, w_res) == range(1, 11)
w_res = space.execute("return (1..10).reject { |i| i < 11 }")
assert self.unwrap(space, w_res) == []

0 comments on commit e691598

Please sign in to comment.