Lines Matching refs:cwr
291 cwr = combinations_with_replacement
292 self.assertRaises(TypeError, cwr, 'abc') # missing r argument
293 self.assertRaises(TypeError, cwr, 'abc', 2, 1) # too many arguments
294 self.assertRaises(TypeError, cwr, None) # pool is not iterable
295 self.assertRaises(ValueError, cwr, 'abc', -2) # r is negative
298 self.assertEqual(list(op(cwr('ABC', 2))),
300 testIntermediate = cwr('ABC', 2)
340 result = list(cwr(values, r))
364 self.pickletest(proto, cwr(values,r)) # test pickling
374 cwr = combinations_with_replacement
375 self.assertEqual(len(set(map(id, cwr('abcde', 3)))), 1)
376 self.assertNotEqual(len(set(map(id, list(cwr('abcde', 3))))), 1)
459 cwr = list(combinations_with_replacement(s, r))
465 self.assertEqual(len(cwr), (fact(n+r-1) / fact(r)/ fact(n-1)) if n else (not r))
471 self.assertEqual(cwr, sorted(set(cwr)))
476 … self.assertEqual(cwr, [t for t in prod if sorted(t)==list(t)]) # cwr: prods which are sorted
479 … self.assertEqual(comb, [t for t in cwr if len(set(t))==r]) # comb: cwrs without dups
480 … self.assertEqual(comb, list(filter(set(cwr).__contains__, perm))) # comb: perm that is a cwr
481 … self.assertEqual(comb, list(filter(set(perm).__contains__, cwr))) # comb: cwr that is a perm
482 … self.assertEqual(comb, sorted(set(cwr) & set(perm))) # comb: both a cwr and a perm
2125 cwr = combinations_with_replacement
2128 check(cwr('abcd', 3), basesize + 3 * self.ssize_t)
2129 check(cwr(range(10), 4), basesize + 4 * self.ssize_t)