'assert that floats x and y are identical, in the sense that:
(1) both x and y are nans, or
(2) both x and y are infinities, with the same sign, or
(3) both x and y are zeros, with the same sign, or
(4) x and y are both finite and nonzero, and x == y'

def assertFloatsAreIdentical(self, x, y):

    msg = 'floats    {!r}    and    {!r}    are    not    identical'
    if (isnan(x) or isnan(y)):
        if (isnan(x) and isnan(y)):
            return
    elif (x == y):
        if (x != 0.0):
            return
        elif (copysign(1.0, x) == copysign(1.0, y)):
            return
        else:
            msg += ':    zeros    have    different    signs'
    self.fail(msg.format(x, y))
