Hi Javier,

A quick reply,

> I have uploaded the conjugacy classes code to the trac server:
> trac.sagemath.org/sage_trac/ticket/7886
> 
> All the test passed, but the sage -coverage command complained about a
> missing testsuite, so I added one (without adding any new test
> functions). Much to my surprise, the testsuite fails testing equality:
> 
> **********************************************************************
> File "/Applications/sage/devel/sage-groups/sage/groups/
> conjugacy_classes.py", line 44:
>     sage: TestSuite(C).run()
> Expected nothing
> Got:
>     Failure in _test_eq:
>     Traceback (most recent call last):
>       File "/Applications/sage/local/lib/python/site-packages/sage/
> misc/sage_unittest.py", line 275, in run
>         test_method(tester = tester)
>       File "parent.pyx", line 726, in
> sage.structure.parent.Parent._test_eq (sage/structure/parent.c:5794)
>       File "/Applications/sage/local/lib/python/site-packages/sage/
> groups/conjugacy_classes.py", line 116, in __cmp__
>         return cmp(self.set(), other.set())
>     AttributeError: 'NoneType' object has no attribute 'set'
>     ------------------------------------------------------------
>     The following tests failed: _test_eq
> **********************************************************************

I think the reason for the failure is that your code assumed that other is
also a conjugacy class. When designing the generic tests for parents, I
decided that it was too much assumed. Therefore, to tests for comparison with
something else, I decided to compare with None:

        File "parent.pyx", line 726:
        [...]
        tester.assertFalse(self == None,
                   LazyFormat("broken equality: %s == None")%self)
        [...]
        tester.assertTrue(self != None,
                   LazyFormat("broken non-equality: %s != None is False")%self)

That's where your code breaks.

Cheers,

Florent

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to