Permalink
Browse files

test_transit: fix the miscaptured-loop-variable bug I always make

  • Loading branch information...
warner committed Dec 1, 2017
1 parent 8a7c6fa commit 1bbd756fa6cb409d06ff41e56ec2f9a06f3d9564
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/wormhole/test/test_transit.py
@@ -20,8 +20,8 @@
class Highlander(unittest.TestCase):
def test_one_winner(self):
cancelled = set()
contenders = [defer.Deferred(lambda d: cancelled.add(i))
for i in range(4)]
contenders = [defer.Deferred(lambda d, i=i: cancelled.add(i))
for i in range(5)]
d = transit.there_can_be_only_one(contenders)
self.assertNoResult(d)
contenders[0].errback(ValueError())
@@ -30,11 +30,11 @@ def test_one_winner(self):
self.assertNoResult(d)
contenders[2].callback("yay")
self.assertEqual(self.successResultOf(d), "yay")
self.assertEqual(cancelled, set([3]))
self.assertEqual(cancelled, set([3,4]))
def test_there_might_also_be_none(self):
cancelled = set()
contenders = [defer.Deferred(lambda d: cancelled.add(i))
contenders = [defer.Deferred(lambda d, i=i: cancelled.add(i))
for i in range(4)]
d = transit.there_can_be_only_one(contenders)
self.assertNoResult(d)

0 comments on commit 1bbd756

Please sign in to comment.