Hi Javier,

On Tue, Dec 06, 2011 at 10:12:08AM -0800, javier wrote:
> 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
> **********************************************************************
> 1 items had failures:
>    1 of  15 in __main__.example_0
> ***Test Failed*** 1 failures.
> For whitespace errors, see the file /Users/javier/.sage//tmp/
> conjugacy_classes_23354.py
>        [5.2 s]
> 
> ----------------------------------------------------------------------
> The following tests failed:
> 
> 
>       sage -t  "devel/sage-groups/sage/groups/conjugacy_classes.py"
> Total time for all tests: 5.2 seconds
> 
> 
> I have no idea what is going on here. I defined a __cmp__ method for
> comparing conjugacy classes that essentially just compares the
> underlying sets, and the doctest for that function works as expected,
> so I don't know what is making the testsuite fail.
> 
> Any ideas?

Yep ! You assume that you are only comparing a conjugacy class with another
conjugacy class. The testSuite assume that you can also compare with other
kinds of objects and in particular None:

        tester.assertFalse(self == None,
                   LazyFormat("broken equality: %s == None")%self)

That's where your code breaks, I think !

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