durusmail: durus-users: Unit test issue
Unit test issue
2006-10-12
2006-10-12
Unit test issue
David Binger
2006-10-12
On Oct 12, 2006, at 2:02 PM, Patrick K. O'Brien wrote:

> I'm confused as to how this unit test is passing:
>
>     def test__eq__(self):
>         s1 = set_type()
>         s2 = other_type()
>         if set_type != other_type:
>             raises(TypeError, s1.__eq__, s2)
>             return
>
> When the code for PersistentSet looks like this:
>
>     def __eq__(self, other):
>         if not isinstance(other, PersistentSet):
>             return False
>         return self.data == other.data
>
> Is it possible that raises() in Sancho is not working properly?

Sancho raises() works fine.  The only problem is that
this unittest is not using it correctly.
raises() just returns a boolean.
It needs an assert in this test, and I guess this particular
line should just be "assert not (s1 == s2)".

> If so,
> would you want to consider switching to regular unit tests?  That's
> what
> we have done with our fork of Durus.  Converting the tests was
> easy, and
> we run them using Nose.

I like sancho.

>
> P.S.  There are other tests that are similarly broken.

I'll fix them.  Thanks.



reply