Hi Simon and Florent, Let me answer you both in one post, since I think your solutions might be related. I agree with Simon that this is the offending line:
tester.assert_(isinstance(self, self.parent().category().element_class)) Now, by adding the line Element = DifferentialForm to my parent class as Florent suggested, I tried to make it so that element_class refers to DifferentialForm. However, the assert still fails. Is there an example of a minimal code using the categories framework that I could adapt? I tried to find out where the problem might be by trying a standard type of element, but these problems persist: sage: u = polygen(QQ) sage: isinstance(u, u.parent().category().element_class) False In the meantime, I see that SteenrodAlgebra has also this problem.... Any ideas? All the best, Joris On 29 jul, 11:32, Florent Hivert <florent.hiv...@univ-rouen.fr> wrote: > > everything works well (no output), but when I run F._test_elements() I > > get an error in ... _test_category(). The precise error is listed > > below, but the traceback tells me that the problem arose in > > element.pyx: > > > if not is_extension_type(self.__class__): > > # For usual Python classes, that should be done with > > # standard inheritance > > tester.assert_(isinstance(self, > > self.parent().category().element_class)) > > > Did I mess up with my use of the sage categories somewhere? Any help > > would be much appreciated, and I can readily supply additional > > information. > > Did you tell the parent what is the class of its elements ? Specifically when > creating a parent with the category framework you need either to write > > class MyParentClass(...): > ... > class Element(...): > ... > > Or else > > class MyElementClass(...): > ... > class MyParentClass(...): > ... > Element = MyElementClass > > Then the category framework create for you a dynamic class called > > MyParentClass.element_class > > Hope this helps, > > 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