181 |
def check_messages(self, messages): |
def check_messages(self, messages): |
182 |
"""Check whether the messages received match the list messages""" |
"""Check whether the messages received match the list messages""" |
183 |
self.assertEquals(messages, self.received_messages) |
self.assertEquals(messages, self.received_messages) |
184 |
|
|
185 |
|
class FloatTestCase(unittest.TestCase): |
186 |
|
"""TestCase with methods for testing floating point values""" |
187 |
|
|
188 |
|
fp_epsilon = 1e-6 |
189 |
|
fp_inf = float('1e1000') # FIXME: hack for infinite |
190 |
|
|
191 |
|
def assertFloatEqual(self, first, second, msg=None): |
192 |
|
"""Fail if one float is greater than the other + fp_epsilon""" |
193 |
|
if abs(first) == self.fp_inf: |
194 |
|
self.assertEqual(first, second, msg) |
195 |
|
else: |
196 |
|
self.assert_(self.fp_epsilon > abs(first - second), msg) |
197 |
|
|