@@ -789,10 +789,10 @@ def allot(
789789 Any attempt to convert a document that has an incorrect structure raises
790790 an exception.
791791
792- >>> allot(1.23 )
792+ >>> allot({1, 2, 3} )
793793 Traceback (most recent call last):
794794 ...
795- TypeError: integer, boolean , string, list, dictionary, or None expected
795+ TypeError: boolean, integer, float , string, list, dictionary, or None expected
796796 >>> allot({'id': 0, 'age': {'%allot': [1, 2, 3], 'extra': [1, 2, 3]}})
797797 Traceback (most recent call last):
798798 ...
@@ -807,7 +807,7 @@ def allot(
807807 ValueError: number of shares in subdocument is not consistent
808808 """
809809 # Values and ``None`` are base cases; return a single share.
810- if isinstance (document , (int , bool , str )) or document is None :
810+ if isinstance (document , (bool , int , float , str )) or document is None :
811811 return [document ]
812812
813813 if isinstance (document , list ):
@@ -881,7 +881,7 @@ def allot(
881881 return shares
882882
883883 raise TypeError (
884- 'integer, boolean , string, list, dictionary, or None expected'
884+ 'boolean, integer, float , string, list, dictionary, or None expected'
885885 )
886886
887887def unify (
@@ -920,13 +920,15 @@ def unify(
920920 >>> data = {
921921 ... 'a': [1, [2, 3]],
922922 ... 'b': [4, 5, 6],
923- ... 'c': None
923+ ... 'c': None,
924+ ... 'd': 1.23
924925 ... }
925926 >>> sk = SecretKey.generate({'nodes': [{}, {}, {}]}, {'store': True})
926927 >>> encrypted = {
927928 ... 'a': {'%allot': [encrypt(sk, 1), [encrypt(sk, 2), encrypt(sk, 3)]]},
928929 ... 'b': {'%allot': [encrypt(sk, 4), encrypt(sk, 5), encrypt(sk, 6)]},
929- ... 'c': None
930+ ... 'c': None,
931+ ... 'd': 1.23
930932 ... }
931933 >>> shares = allot(encrypted)
932934 >>> decrypted = unify(sk, shares)
0 commit comments