Ticket #14471: trac_14471-review.patch

File trac_14471-review.patch, 1.3 KB (added by SimonKing, 8 years ago)
  • sage/structure/parent.pyx

    # HG changeset patch
    # User Simon King <simon.king@uni-jena.de>
    # Date 1372337438 -7200
    # Node ID b73eb37ab64613c2d5fefb262474fd4ca3166155
    # Parent  f55212c0bfdcacc28b895706008c6500c223fafe
    Review patch: Extend some test
    
    diff --git a/sage/structure/parent.pyx b/sage/structure/parent.pyx
    a b  
    450450            ....:     def __hash__(self):
    451451            ....:         return hash(type(self))   # subtle mistake
    452452            sage: a = MyParent()
    453             sage: h = hash(a)
     453            sage: h_a = hash(a)
    454454            sage: a._refine_category_(Algebras(QQ))
    455455            hash of <class '__main__.MyParent_with_category'> changed in
    456456            Parent._refine_category_ during initialisation
    457457
    458458            sage: b = MyParent(category=Rings())
    459             sage: h = hash(b)
     459            sage: h_b = hash(b)
     460            sage: h_a == h_b
     461            False
    460462            sage: b._refine_category_(Algebras(QQ))
    461463            hash of <class '__main__.MyParent_with_category'> changed in
    462464            Parent._refine_category_ during refinement
     465            sage: hash(a) == hash(b)
     466            True
     467            sage: hash(a) != h_a
     468            True
     469
    463470        """
    464471        if debug.refine_category_hash_check:
    465472            # check that the hash stays the same after refinement