(self)
Check that the fixed length partition outputs are correct.
Check that the fixed length partition outputs are correct.
Check that the fixed length partition outputs are correct .
def testFixedLength(self):
        """Check that the fixed length partition outputs are correct."""
        for n in range(len(self.counts)):
            pn = [list(p) for p in revlex_partitions(n)]
            pn.sort()
            np = 0
            for L in range(n+1):
                pnL = [list(p) for p in fixed_length_partitions(n,L)]
                pnL.sort()
                np += len(pnL)
                self.assertEqual(pnL,[p for p in pn if len(p) == L])
            self.assertEqual(np,len(pn))
def testFixedLength ( self ) : for n in range ( len ( self . counts ) ) : pn = [ list ( p ) for p in revlex_partitions ( n ) ] pn . sort ( ) np = 0 for L in range ( n + 1 ) : pnL = [ list ( p ) for p in fixed_length_partitions ( n , L ) ] pnL . sort ( ) np += len ( pnL ) self . assertEqual ( pnL , [ p for p in pn if len ( p ) == L ] ) self . assertEqual ( np , len ( pn ) )