@@ -751,6 +751,10 @@ def testHypot(self):
751751 self .assertEqual (1.0 ,
752752 math .copysign (1.0 , hypot (- 0.0 )) # Convert negative zero to positive zero
753753 )
754+ self .assertEqual ( # Handling of moving max to the end
755+ hypot (1.5 , 1.5 , 0.5 ),
756+ hypot (1.5 , 0.5 , 1.5 ),
757+ )
754758
755759 # Test handling of bad arguments
756760 with self .assertRaises (TypeError ): # Reject keyword args
@@ -771,7 +775,7 @@ def testHypot(self):
771775 self .assertEqual (hypot (- INF , - INF ), INF )
772776 self .assertEqual (hypot (10 , - INF ), INF )
773777
774- # If no infinity, any NaN gives a Nan .
778+ # If no infinity, any NaN gives a NaN .
775779 self .assertTrue (math .isnan (hypot (NAN )))
776780 self .assertTrue (math .isnan (hypot (0 , NAN )))
777781 self .assertTrue (math .isnan (hypot (NAN , 10 )))
@@ -831,9 +835,13 @@ def testDist(self):
831835 self .assertEqual (1.0 , # Convert negative zero to positive zero
832836 math .copysign (1.0 , dist ((0.0 ,), (- 0.0 ,)))
833837 )
838+ self .assertEqual ( # Handling of moving max to the end
839+ dist ((1.5 , 1.5 , 0.5 ), (0 , 0 , 0 )),
840+ dist ((1.5 , 0.5 , 1.5 ), (0 , 0 , 0 ))
841+ )
834842
835843 # Verify tuple subclasses are allowed
836- class T (tuple ): # tuple subclas
844+ class T (tuple ):
837845 pass
838846 self .assertEqual (dist (T ((1 , 2 , 3 )), ((4 , 2 , - 1 ))), 5.0 )
839847
@@ -855,8 +863,7 @@ class T(tuple): # tuple subclas
855863 with self .assertRaises (ValueError ): # Check dimension agree
856864 dist ((1 , 2 , 3 ), (4 , 5 , 6 , 7 ))
857865
858-
859- # Verify that the one dimensional case equivalent to abs()
866+ # Verify that the one dimensional case is equivalent to abs()
860867 for i in range (20 ):
861868 p , q = random .random (), random .random ()
862869 self .assertEqual (dist ((p ,), (q ,)), abs (p - q ))
@@ -870,7 +877,7 @@ class T(tuple): # tuple subclas
870877 # Any infinite difference gives positive infinity.
871878 self .assertEqual (dist (p , q ), INF )
872879 elif any (map (math .isnan , diffs )):
873- # If no infinity, any NaN gives a Nan .
880+ # If no infinity, any NaN gives a NaN .
874881 self .assertTrue (math .isnan (dist (p , q )))
875882
876883 # Verify scaling for extremely large values
0 commit comments