Lines Matching refs:take
44 def take(n, seq): function
68 self.assertEqual(take(4, c('abc', 'def')), list('abcd'))
75 self.assertEqual(take(4, chain.from_iterable(['abc', 'def'])), list('abcd'))
349 self.assertEqual(take(2, zip('abc',count(3))), [('a', 3), ('b', 4)])
350 self.assertEqual(take(2, zip('abc',count(-1))), [('a', -1), ('b', 0)])
351 self.assertEqual(take(2, zip('abc',count(-3))), [('a', -3), ('b', -2)])
354 self.assertEqual(take(10, count(maxsize-5)), range(maxsize-5, maxsize+5))
355 self.assertEqual(take(10, count(-maxsize-5)), range(-maxsize-5, -maxsize+5))
356 self.assertEqual(take(3, count(3.25)), [3.25, 4.25, 5.25])
357 self.assertEqual(take(3, count(3.25-4j)), [3.25-4j, 4.25-4j, 5.25-4j])
358 self.assertEqual(take(3, count(Decimal('1.1'))),
360 self.assertEqual(take(3, count(Fraction(2, 3))),
363 self.assertEqual(take(3, count(BIGINT)), [BIGINT, BIGINT+1, BIGINT+2])
401 … self.assertEqual(take(20, count(maxsize-15, 3)), take(20, range(maxsize-15, maxsize+100, 3)))
402 … self.assertEqual(take(20, count(-maxsize-15, 3)), take(20, range(-maxsize-15,-maxsize+100, 3)))
403 self.assertEqual(take(3, count(10, maxsize+5)),
405 self.assertEqual(take(3, count(2, 1.25)), [2, 3.25, 4.5])
406 self.assertEqual(take(3, count(2, 3.25-4j)), [2, 5.25-4j, 8.5-8j])
407 self.assertEqual(take(3, count(Decimal('1.1'), Decimal('.1'))),
409 self.assertEqual(take(3, count(Fraction(2,3), Fraction(1,7))),
412 self.assertEqual(take(3, count(step=BIGINT)), [0, BIGINT, 2*BIGINT])
413 self.assertEqual(repr(take(3, count(10, 2.5))), repr([10, 12.5, 15.0]))
445 self.assertEqual(take(10, cycle('abc')), list('abcabcabca'))
544 self.assertEqual(take(4, ifilter(isEven, count())), [0,2,4,6])
555 self.assertEqual(take(4, ifilterfalse(isEven, count())), [1,3,5,7])
567 self.assertEqual(take(3,izip('abcdef', count())), zip('abcdef', range(3)))
601 …self.assertEqual(take(3,izip_longest('abcdef', count())), zip('abcdef', range(3))) # take 3 from i…
751 self.assertEqual(take(3, repeat('a')), ['a', 'a', 'a'])
777 self.assertEqual(take(2,imap(None, 'abc', count())),
789 self.assertEqual(take(3, starmap(operator.pow, izip(count(), count(1)))),