Home | History | Annotate | Download | only in test

Lines Matching refs:cwr

115             'Pure python version from cwr()'
146 cwr = combinations_with_replacement
147 self.assertRaises(TypeError, cwr, 'abc') # missing r argument
148 self.assertRaises(TypeError, cwr, 'abc', 2, 1) # too many arguments
149 self.assertRaises(TypeError, cwr, None) # pool is not iterable
150 self.assertRaises(ValueError, cwr, 'abc', -2) # r is negative
151 self.assertEqual(list(cwr('ABC', 2)),
188 result = list(cwr(values, r))
213 cwr = combinations_with_replacement
214 self.assertEqual(len(set(map(id, cwr('abcde', 3)))), 1)
215 self.assertNotEqual(len(set(map(id, list(cwr('abcde', 3))))), 1)
290 cwr = list(combinations_with_replacement(s, r))
296 self.assertEqual(len(cwr), (fact(n+r-1) // fact(r) // fact(n-1)) if n else (not r))
302 self.assertEqual(cwr, sorted(set(cwr)))
307 self.assertEqual(cwr, [t for t in prod if sorted(t)==list(t)]) # cwr: prods which are sorted
310 self.assertEqual(comb, [t for t in cwr if len(set(t))==r]) # comb: cwrs without dups
311 self.assertEqual(comb, filter(set(cwr).__contains__, perm)) # comb: perm that is a cwr
312 self.assertEqual(comb, filter(set(perm).__contains__, cwr)) # comb: cwr that is a perm
313 self.assertEqual(comb, sorted(set(cwr) & set(perm))) # comb: both a cwr and a perm