@@ -863,29 +863,7 @@ def test_short_repr(self):
863
863
self .assertEqual (repr (float (negs )), str (float (negs )))
864
864
865
865
@support .requires_IEEE_754
866
- class RoundTestCase (unittest .TestCase ):
867
-
868
- def assertFloatsAreIdentical (self , x , y ):
869
- """Fail unless floats x and y are identical, in the sense that:
870
- (1) both x and y are nans, or
871
- (2) both x and y are infinities, with the same sign, or
872
- (3) both x and y are zeros, with the same sign, or
873
- (4) x and y are both finite and nonzero, and x == y
874
- """
875
- msg = 'floats {!r} and {!r} are not identical'
876
-
877
- if isnan (x ) or isnan (y ):
878
- if isnan (x ) and isnan (y ):
879
- return
880
- elif x == y :
881
- if x != 0.0 :
882
- return
883
- # both zero; check that signs match
884
- elif copysign (1.0 , x ) == copysign (1.0 , y ):
885
- return
886
- else :
887
- msg += ': zeros have different signs'
888
- self .fail (msg .format (x , y ))
866
+ class RoundTestCase (unittest .TestCase , FloatsAreIdenticalMixin ):
889
867
890
868
def test_inf_nan (self ):
891
869
self .assertRaises (OverflowError , round , INF )
0 commit comments