#8800: Doctest coverage of categories
--------------------------+-------------------------------------------------
   Reporter:  SimonKing   |       Owner:  Simon King         
       Type:  defect      |      Status:  new                
   Priority:  major       |   Milestone:  sage-4.4.1         
  Component:  categories  |    Keywords:  categories doctests
     Author:  Simon King  |    Upstream:  N/A                
   Reviewer:              |      Merged:                     
Work_issues:              |  
--------------------------+-------------------------------------------------

Comment(by SimonKing):

 Next bug:
 {{{
 sage: F = QQ['x'].construction()[0]
 sage: F
 Poly[x]
 sage: F == IdentityFunctor(Rings())
 False
 sage: IdentityFunctor(Rings()) == F
 True

 }}}
 This is since the cmp method of ``IdentityFunctor_generic`` only checks
 whether domain and codomain coincide, but doesn't check the type of the
 functor.

 Even worse, comparison it may raise an error - how unpythonic!
 {{{
 sage: IdentityFunctor(Rings()) == QQ
 ---------------------------------------------------------------------------
 AttributeError                            Traceback (most recent call
 last)

 /home/king/SAGE/patches/doku/english/<ipython console> in <module>()

 /home/king/SAGE/sage-4.3.1/local/lib/python2.6/site-
 packages/sage/categories/functor.so in
 sage.categories.functor.ForgetfulFunctor_generic.__cmp__
 (sage/categories/functor.c:1429)()

 /home/king/SAGE/sage-4.3.1/local/lib/python2.6/site-
 packages/sage/structure/parent.so in
 sage.structure.parent.Parent.__getattr__ (sage/structure/parent.c:5064)()

 /home/king/SAGE/sage-4.3.1/local/lib/python2.6/site-
 packages/sage/structure/parent.so in
 sage.structure.parent.getattr_from_other_class
 (sage/structure/parent.c:2738)()

 /home/king/SAGE/sage-4.3.1/local/lib/python2.6/site-
 packages/sage/structure/parent.so in
 sage.structure.parent.raise_attribute_error
 (sage/structure/parent.c:2610)()

 AttributeError: 'RationalField_with_category' object has no attribute
 'domain'
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8800#comment:4>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to