@@ -685,6 +685,8 @@ def msum(iterable):
685685 ([], 0.0 ),
686686 ([0.0 ], 0.0 ),
687687 ([1e100 , 1.0 , - 1e100 , 1e-100 , 1e50 , - 1.0 , - 1e50 ], 1e-100 ),
688+ ([1e100 , 1.0 , - 1e100 , 1e-100 , 1e50 , - 1 , - 1e50 ], 1e-100 ),
689+ ([1e100 , FloatLike (1.0 ), - 1e100 , 1e-100 , 1e50 , FloatLike (- 1.0 ), - 1e50 ], 1e-100 ),
688690 ([2.0 ** 53 , - 0.5 , - 2.0 ** - 54 ], 2.0 ** 53 - 1.0 ),
689691 ([2.0 ** 53 , 1.0 , 2.0 ** - 100 ], 2.0 ** 53 + 2.0 ),
690692 ([2.0 ** 53 + 10.0 , 1.0 , 2.0 ** - 100 ], 2.0 ** 53 + 12.0 ),
@@ -733,9 +735,18 @@ def msum(iterable):
733735 self .assertEqual (msum (vals ), math .fsum (vals ))
734736
735737 self .assertEqual (math .fsum ([1.0 , math .inf ]), math .inf )
738+ self .assertTrue (math .isnan (math .fsum ([math .nan , 1.0 ])))
736739 self .assertRaises (OverflowError , math .fsum , [1e+308 , 1e+308 ])
737740 self .assertRaises (ValueError , math .fsum , [math .inf , - math .inf ])
738741 self .assertRaises (TypeError , math .fsum , ['spam' ])
742+ self .assertRaises (TypeError , math .fsum , 1 )
743+ self .assertRaises (OverflowError , math .fsum , [10 ** 1000 ])
744+
745+ def bad_iter ():
746+ yield 1.0
747+ raise ZeroDivisionError
748+
749+ self .assertRaises (ZeroDivisionError , math .fsum , bad_iter ())
739750
740751 def testGcd (self ):
741752 gcd = math .gcd
0 commit comments