Good catch, that's definitely a bug in the test. I'll fix it -- fortunately
the code it tests is correct!


On Sat, Feb 8, 2014 at 5:06 PM, Victor Stinner <victor.stin...@gmail.com>wrote:

> Hi,
>
> While testing Trollius on Python 2.6, I noticed a new test which uses
> the syntax for set literal (see below). It looks like the test is
> wrong: it should test duplicated coroutines, but it pass a set to
> as_completed(): the duplicated are removed during the creation of the
> set ...
>
>     def test_as_completed_duplicate_coroutines(self):
>         @asyncio.coroutine
>         def coro(s):
>             return s
>
>         @asyncio.coroutine
>         def runner():
>             result = []
>             c = coro('ham')
>             for f in asyncio.as_completed({c, c, coro('spam')},
> loop=self.loop):
>                 result.append((yield from f))
>             return result
>
>         fut = asyncio.Task(runner(), loop=self.loop)
>         self.loop.run_until_complete(fut)
>         result = fut.result()
>         self.assertEqual(set(result), {'ham', 'spam'})
>         self.assertEqual(len(result), 2)
>
> Victor
>



-- 
--Guido van Rossum (python.org/~guido)

Reply via email to