248 |
|
|
249 |
fp_epsilon = 1e-6 |
fp_epsilon = 1e-6 |
250 |
fp_inf = float('1e1000') # FIXME: hack for infinite |
fp_inf = float('1e1000') # FIXME: hack for infinite |
251 |
|
|
252 |
def assertFloatEqual(self, test, value, epsilon = None): |
def assertFloatEqual(self, test, value, epsilon = None): |
253 |
"""Assert equality of test and value with some tolerance. |
"""Assert equality of test and value with some tolerance. |
254 |
|
|
273 |
for i in range(len(test)): |
for i in range(len(test)): |
274 |
self.assertFloatEqual(test[i], value[i], epsilon) |
self.assertFloatEqual(test[i], value[i], epsilon) |
275 |
|
|
276 |
|
def assertPointListEquals(self, test, value): |
277 |
|
"""Assert equality of two lists of lists of tuples of float |
278 |
|
|
279 |
|
This assertion is usually used to compare the geometry of shapes |
280 |
|
as returned by a Shape object's Points() method, hence the name. |
281 |
|
""" |
282 |
|
for i in range(len(test)): |
283 |
|
self.assertEquals(len(test[i]), len(value[i])) |
284 |
|
for j in range(len(test[i])): |
285 |
|
self.assertFloatSeqEqual(test[i][j], value[i][j]) |
286 |
|
|
287 |
|
|
288 |
class SubscriberMixin: |
class SubscriberMixin: |
289 |
|
|
290 |
"""Mixin class for tests for messages sent through the Connector |
"""Mixin class for tests for messages sent through the Connector |