viff

changeset 623:86aaaa6b9ece

Added doctest to gather_shares.
author Martin Geisler <mg@daimi.au.dk>
date Sat, 29 Mar 2008 20:54:24 +0100
parents 2b9d4c9e959b
children 0321258dd66e
files viff/runtime.py
diffstat 1 files changed, 18 insertions(+), 1 deletions(-) [+]
line diff
     1.1 --- a/viff/runtime.py	Sat Mar 29 19:40:05 2008 +0100
     1.2 +++ b/viff/runtime.py	Sat Mar 29 20:54:24 2008 +0100
     1.3 @@ -214,7 +214,24 @@
     1.4  def gather_shares(shares):
     1.5      """Gather shares.
     1.6  
     1.7 -    Roughly modelled after the Twisted C{gatherResults} function.
     1.8 +    Roughly modelled after the Twisted C{gatherResults} function. It
     1.9 +    takes a list of shares and returns a new L{Share} which will be
    1.10 +    triggered with a list of values, namely the values from the
    1.11 +    initial shares:
    1.12 +
    1.13 +    >>> from pprint import pprint
    1.14 +    >>> from viff.field import GF256
    1.15 +    >>> a = Share(None, GF256)
    1.16 +    >>> b = Share(None, GF256)
    1.17 +    >>> shares = gather_shares([a, b])
    1.18 +    >>> shares.addCallback(pprint)           # doctest: +ELLIPSIS
    1.19 +    <ShareList at 0x...>
    1.20 +    >>> a.callback(10)
    1.21 +    >>> b.callback(20)
    1.22 +    [10, 20]
    1.23 +
    1.24 +    @param shares: the shares.
    1.25 +    @type shares: C{list} of L{Share} objects
    1.26      """
    1.27  
    1.28      def filter_results(results):