[Answer]-Django assertEquals() test failing even though answer is equal

1👍

There seems to be some funny business with how the Distance class equality is actually implemented:

https://github.com/django/django/blob/master/django/contrib/gis/measure.py#L87

Reading that code, it looks like what you have should work… but apparently it doesn’t.

I suspect you can fix your problem by comparing specific unit values like so:


self.assertEquals(l.inch, D(inch=689.5).inch)

Leave a comment