When we use TestCase.assertAlmostEqual to compare two float('inf') objects, the result is that float('inf') is not almost equal to float('inf'). I believe this is a bug. I tested against r74195 of Python 3.2 and against Python 2.6.2.
Uhm... they may or may not be almost equal, but probably not. Comparisons on them are defined to be undefined so you're using the wrong thing to test them. Use assertTrue and math.isinf instead.
I would like to ask as a feature request that "inf" be almost equal to "inf". I wrote a program with a timeline class that had a method to tell the time of the last event registered into it such that some events would be positioned at the infinite when they wouldn't occur. I did generic tests that would receive any output from this method and compare to the expected result through unittest.TestCase.assertAlmostEqual(). Notice, though, that I couldn't just pick assertEqual() to do this job because the time of the last event would be defined through a series of calculations. Despite that, I believe that everything which is equal to anything else would definitely be almost equal too. Thus, it would be nice to check for equality before checking for almost-equality to define whether two objects are almost equal.
[lucaspmelo] > I would like to ask as a feature request that "inf" be almost equal to > "inf". Sounds reasonable to me. Just so long as float('-inf') isn't almost equal to float('inf'); that would be weird. One could almost make a case for values very close to the upper limit of the floating-point range being almost equal to float('inf'), but I think that's taking things a bit too far.