Ticket #12919: trac_12919_coercion_typo_parent-nt.patch

File trac_12919_coercion_typo_parent-nt.patch, 2.0 KB (added by nthiery, 9 years ago)
  • sage/structure/parent.pyx

    # HG changeset patch
    # User Nicolas M. Thiery <nthiery@users.sf.net>
    # Date 1337227646 14400
    # Node ID a42ba240a43fc458d1e0d8fa18d2504c391374bd
    # Parent  87b3a7602fdaba4cec0d4c303b5d5a0cba60a649
    #12919: Typo in Parent.discover_coerce_map_from
    
    diff --git a/sage/structure/parent.pyx b/sage/structure/parent.pyx
    a b cdef class Parent(category_object.Catego 
    22132213
    22142214        3. Traverse the coercion lists looking for another map
    22152215           returning the map from step (2) if none is found.
    2216                
    2217         In the future, multiple paths may be discovered and compared.
     2216
     2217        In the future, multiple paths may be discovered and compared.
     2218
     2219        TESTS:
     2220
     2221        Regression test for :trac:`12919` (probably not 100% robust)::
     2222
     2223            sage: class P(Parent):
     2224            ...       def __init__(self):
     2225            ...           Parent.__init__(self, category=Sets())
     2226            ...       Element=ElementWrapper
     2227            sage: A = P(); a = A('a')
     2228            sage: B = P(); b = B('b')
     2229            sage: C = P(); c = C('c')
     2230            sage: D = P(); d = D('d')
     2231            sage: Hom(A, B)(lambda x: b).register_as_coercion()
     2232            sage: Hom(B, A)(lambda x: a).register_as_coercion()
     2233            sage: Hom(C, B)(lambda x: b).register_as_coercion()
     2234            sage: Hom(D, C)(lambda x: c).register_as_coercion()
     2235            sage: A(d)
     2236            'a'
     2237
    22182238        """
    22192239        best_mor = None
    22202240        if PY_TYPE_CHECK(S, Parent) and (<Parent>S)._embedding is not None:
    cdef class Parent(category_object.Catego 
    22722292                if mor_found  >= num_paths:
    22732293                    return best_mor
    22742294            else:
    2275                 connection = None
     2295                connecting = None
    22762296                if EltPair(mor._domain, S, "coerce") not in _coerce_test_dict:
    22772297                    connecting = mor._domain.coerce_map_from(S)
    22782298                if connecting is not None: