Skip to content
Permalink
Browse files

simplification, removal of duplicate tests, style changes

  • Loading branch information
Alex Gaynor
Alex Gaynor committed Mar 12, 2013
1 parent 43b86c3 commit b1db16d5fe71d0defdc18495bc7b27c50631d8fe
Showing with 6 additions and 16 deletions.
  1. +3 −13 tests/objects/test_objectobject.py
  2. +3 −3 topaz/objects/objectobject.py
@@ -394,19 +394,9 @@ def test_tap(self, space):
with self.raises(space, "LocalJumpError"):
space.execute("1.tap")

with self.raises(space, "LocalJumpError"):
space.execute("'1'.tap")

w_res = space.execute("""
x = nil
1.tap{ |c| x = c }
return x
""")
assert self.unwrap(space, w_res) == 1

w_res = space.execute("""
x = nil
[].tap{ |c| x = c }
return x
res = 1.tap { |c| x = c + 1 }
return res, x
""")
assert self.unwrap(space, w_res) == []
assert self.unwrap(space, w_res) == [1, 2]
@@ -182,11 +182,11 @@ def method_method(self, space, w_sym):
)

@classdef.method("tap")
def method_tap(self, space, block=None):
def method_tap(self, space, block):
if block is not None:
space.invoke_block(block, [self])
space.invoke_block(block, [self])
else:
raise space.error(space.w_LocalJumpError, "no block given")
raise space.error(space.w_LocalJumpError, "no block given")
return self


0 comments on commit b1db16d

Please sign in to comment.
You can’t perform that action at this time.