#9469: Category membership, without arguments
------------------------------+---------------------------------------------
Reporter: nthiery | Owner: nthiery
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-5.0
Component: categories | Keywords: Cernay2012
Work_issues: | Upstream: N/A
Reviewer: Florent Hivert | Author: Nicolas M. ThiƩry
Merged: | Dependencies:
------------------------------+---------------------------------------------
Changes (by nthiery):
* status: positive_review => needs_work
Comment:
I just stumbled upon the following hunk later in the queue, and thought we
might as well
fold it into this patch:
{{{
diff --git a/sage/categories/category.py b/sage/categories/category.py
--- a/sage/categories/category.py
+++ b/sage/categories/category.py
@@ -627,8 +627,19 @@ class Category(UniqueRepresentation, Sag
sage: F in Algebras
False
+
+ TESTS:
+
+ Non category object shall be handled properly::
+
+ sage: [1,2] in Algebras
+ False
"""
- return any(isinstance(cat, cls) for cat in x.categories())
+ try:
+ c = x.categories()
+ except AttributeError:
+ return False
+ return any(isinstance(cat, cls) for cat in c)
def is_abelian(self):
"""
}}}
I am running the tests now. Florent: shall I reinstate the positive review
if the test pass?
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9469#comment:8>
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.