Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow post-creation (pre-use) declaration of coercions #5598

Closed
robertwb opened this issue Mar 24, 2009 · 25 comments
Closed

allow post-creation (pre-use) declaration of coercions #5598

robertwb opened this issue Mar 24, 2009 · 25 comments

Comments

@robertwb
Copy link
Contributor

One can now do

a = A()
mor = [morphism from X to A]
A.register_coercion(mor)

This works as long as coercion has not yet been used (otherwise information cached (both here and elsewhere) becomes invalid).

CC: @nthiery

Component: coercion

Author: Robert Bradshaw

Reviewer: Nick Alexander

Merged: sage-4.2.alpha1

Issue created by migration from https://trac.sagemath.org/ticket/5598

@robertwb robertwb added this to the sage-4.2 milestone Mar 24, 2009
@robertwb robertwb self-assigned this Mar 24, 2009
@robertwb
Copy link
Contributor Author

comment:1

Attachment: 5598-coerce-declare.patch.gz

Depends on #5597.

@robertwb
Copy link
Contributor Author

comment:2

One can now do

sage: A = SomeParent()
sage: mor = [morphism from X to A]
sage: A.register_coercion(mor)

This works as long as coercion has not yet been used (otherwise information cached (both here and elsewhere) becomes invalid).

@robertwb

This comment has been minimized.

@robertwb
Copy link
Contributor Author

comment:5

Actually, though I wrote it on top of #5597, there's probably not a dependance. Note that I don't have any doctests yet (as it's completely unused functionality at this point).

@williamstein
Copy link
Contributor

comment:6

Note that I don't have any doctests yet (as it's completely unused
functionality at this point).

Hence I'm physically incapable of giving this a positive review. Sorry.

@nthiery
Copy link
Contributor

nthiery commented Apr 14, 2009

comment:7

Attachment: test-coercion.py.gz

I have been using this patch (or actually a plain python version of it; see the sage-combinat patch queue) relatively intensively, and it does its job well. However it's hard to extract any interesting unitary test from those uses, since they all rely on the rest of the category stuff.

I have just attached a stupid test instead ... It just plays with register_coercion, but should be easy to adapt to the others.

Btw: robert: would it be possible to have register_coercion just raise a warning if coercions have readily been used? There are cases where it can be handy to abuse the system a bit from the interpreter.

@robertwb
Copy link
Contributor Author

comment:8

Thanks for the tests. In retrospect, sometimes very simple tests like this are best at showing exactly what's going on.

As for warnings vs. errors, yes it's possible, but I am strongly against it. If you need to abuse it, you can do so from Cython (or even write a spyx file that allows you to do so from the interpreter).

There was talk about asserting coercions within contexts, but no one's gotten around to implementing them yet.

@nthiery
Copy link
Contributor

nthiery commented Apr 14, 2009

comment:9

Hi Robert,

Thanks for the tests. In retrospect, sometimes very simple tests like this are best at showing exactly what's going on.

Yep.

The construction of the parents and morphisms in this test are still ugly, though. Both ought to be essentially one-liners. Hopefuly things will be nicer when the category patch will be in.

As for warnings vs. errors, yes it's possible, but I am strongly against it. If you need to abuse it, you can > do so from Cython (or even write a spyx file that allows you to do so from the interpreter).

My typical (ab)use case is someone constructing a couple parents in the interpreter, playing with them, and suddenly thinking "oh, but wouldn't all be natural if I added a coercion there?". The user will give it a try if this is trivial to do. Otherwise he won't and that's too bad.

Btw: your patch changes the datastructure of parents to add the cython attribute _coercions_used. How does this work with unpickling old pickles? That is, will _coercions_used be set to an appropriate value?

There was talk about asserting coercions within contexts, but no one's gotten around to implementing them yet.

@ncalexan
Copy link
Mannequin

ncalexan mannequin commented May 6, 2009

comment:10

This is all kinds of awesome, and yet totally useless. For example, the following fails:

x = GF(3)['x'].0
K.<a> = GF(3^2, 'a', modulus=x^2+1)
L.<b> = GF(3^2, 'b', modulus=x^2 + x - 1)

L_into_K = L.hom([a - 2], K, check=False)
K.register_coercion(L_into_K)

Why? Because the a-2 has used the coercion mechanism for K. It will be essentially impossible to construct morphisms that are mathematically interesting without using coercion at some point.

What is to be done? I have no great ideas. Personally I would be happy with a flag to register_coercion that "broke the links" of the coercion graph, or even tried to reset_cache() on the coercion_model. Notice that I tried this, but it doesn't work, because reset_cache doesn't twiddle the flag on each parent. (That's a bug, in my opinion.)

@ncalexan
Copy link
Mannequin

ncalexan mannequin commented May 6, 2009

comment:11

Apply both 5598- patches. My fixes make actions work (they're still broken pretty hard in parent_old, but they work here) and test this code in a non-combinat tree. In order to make this work I include an ugly hack.

robertwb, this badly needs documentation; it really can't be accepted without something.

@ncalexan ncalexan mannequin added s: needs review and removed s: needs work labels May 6, 2009
@robertwb
Copy link
Contributor Author

robertwb commented May 6, 2009

comment:12

Yes, I just haven't had time to work on any coercion-related stuff for a while. I'll be attacking issues like this during Sage days.

@ncalexan
Copy link
Mannequin

ncalexan mannequin commented May 8, 2009

Attachment: 5598-ncalexan-fixes-and-tests.patch.gz

@ncalexan
Copy link
Mannequin

ncalexan mannequin commented May 8, 2009

comment:13

Updated fixes patch includes a few line of documentation. robertwb, this is ready for you to review.

@robertwb
Copy link
Contributor Author

comment:14

5598-ncalexan-fixes-and-tests.patch seems malformed, could you try recreating this patch?

@ncalexan
Copy link
Mannequin

ncalexan mannequin commented May 17, 2009

Attachment: 5598-ncalexan-fixes-and-tests.2.patch.gz

@ncalexan
Copy link
Mannequin

ncalexan mannequin commented May 17, 2009

comment:15

Attachment: 5598-ncalexan-fixes-and-tests.3.patch.gz

Ah, the mystery of the malformed patches. hg export -o DOESN'T overwrite an existing file, it appends! I think this is totally wrong, but I can work around it. This has been biting me for weeks, I now realize. Anyway, only tests.3.patch should be applied.

@robertwb
Copy link
Contributor Author

comment:16

Attachment: 5598-test-coercion.patch.gz

I made a patch out of test-coercion. Apply, in order

  • 5598-coerce-declare.patch
  • 5598-ncalexan-fixes-and-tests.3.patch
  • 5598-test-coercion.patch (1.9 KB)

I give the tests/documentation a positive review, if someone is willing to give a +1 on the original patch we can get this ticket in.

@ncalexan
Copy link
Mannequin

ncalexan mannequin commented May 23, 2009

comment:17

It's not perfect but it's better than what was there before -- and doctested more than it was before!

@nthiery
Copy link
Contributor

nthiery commented May 23, 2009

comment:18

Just a note: the added test adds a dependency on #5967. The later has a positive review, but Michael asked for a confirmation from a non sage-combinat person. Robert told me he would do this shortly.

@mwhansen
Copy link
Contributor

mwhansen commented Jun 1, 2009

comment:19

I merged

5598-coerce-declare.patch
5598-ncalexan-fixes-and-tests.3.patch
5598-test-coercion.patch

and got the following failures:

**********************************************************************
File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/devel/sage-main/sage/structure/parent.pyx", line 863:
    sage: K.unset_coercions_used()
Exception raised:
    Traceback (most recent call last):
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_21[5]>", line 1, in <module>
        K.unset_coercions_used()###line 863:
    sage: K.unset_coercions_used()
    AttributeError: 'PolynomialRing_integral_domain' object has no attribute 'unset_coercions_used'
**********************************************************************
File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/devel/sage-main/sage/structure/parent.pyx", line 864:
    sage: K.register_coercion(L_into_K)
Exception raised:
    Traceback (most recent call last):
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_21[6]>", line 1, in <module>
        K.register_coercion(L_into_K)###line 864:
    sage: K.register_coercion(L_into_K)
      File "parent.pyx", line 853, in sage.structure.parent.Parent.register_coercion (sage/structure/parent.c:7450)
        cpdef register_coercion(self, mor):
      File "parent.pyx", line 878, in sage.structure.parent.Parent.register_coercion (sage/structure/parent.c:7239)
        assert not self._coercions_used, "coercions must all be registered up before use"
    AssertionError: coercions must all be registered up before use
**********************************************************************
File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/devel/sage-main/sage/structure/parent.pyx", line 866:
    sage: K(0) + b
Exception raised:
    Traceback (most recent call last):
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_21[7]>", line 1, in <module>
        K(Integer(0)) + b###line 866:
    sage: K(0) + b
      File "element.pyx", line 729, in sage.structure.element.ModuleElement.__add__ (sage/structure/element.c:6533)
        return coercion_model.bin_op(left, right, add)
      File "coerce.pyx", line 740, in sage.structure.coerce.CoercionModel_cache_maps.bin_op (sage/structure/coerce.c:6589)
        raise TypeError, arith_error_message(x,y,op)
    TypeError: unsupported operand parent(s) for '+': 'Univariate Polynomial Ring in a over Integer Ring' and 'Univariate Polynomial Ring in b over Integer Ring'
**********************************************************************
File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/devel/sage-main/sage/structure/parent.pyx", line 868:
    sage: a + b
Exception raised:
    Traceback (most recent call last):
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_21[8]>", line 1, in <module>
        a + b###line 868:
    sage: a + b
      File "element.pyx", line 729, in sage.structure.element.ModuleElement.__add__ (sage/structure/element.c:6533)
        return coercion_model.bin_op(left, right, add)
      File "coerce.pyx", line 740, in sage.structure.coerce.CoercionModel_cache_maps.bin_op (sage/structure/coerce.c:6589)
        raise TypeError, arith_error_message(x,y,op)
    TypeError: unsupported operand parent(s) for '+': 'Univariate Polynomial Ring in a over Integer Ring' and 'Univariate Polynomial Ring in b over Integer Ring'
**********************************************************************
File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/devel/sage-main/sage/structure/parent.pyx", line 870:
    sage: K(b) # check that convert calls coerce first; normally this is just a
Expected:
    -a
Got:
    a
**********************************************************************
File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/devel/sage-main/sage/structure/parent.pyx", line 873:
    sage: L(0) + a in K # this goes through the coercion mechanism of K
Exception raised:
    Traceback (most recent call last):
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_21[10]>", line 1, in <module>
        L(Integer(0)) + a in K # this goes through the coercion mechanism of K###line 873:
    sage: L(0) + a in K # this goes through the coercion mechanism of K
      File "element.pyx", line 729, in sage.structure.element.ModuleElement.__add__ (sage/structure/element.c:6533)
        return coercion_model.bin_op(left, right, add)
      File "coerce.pyx", line 740, in sage.structure.coerce.CoercionModel_cache_maps.bin_op (sage/structure/coerce.c:6589)
        raise TypeError, arith_error_message(x,y,op)
    TypeError: unsupported operand parent(s) for '+': 'Univariate Polynomial Ring in b over Integer Ring' and 'Univariate Polynomial Ring in a over Integer Ring'
**********************************************************************
File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/devel/sage-main/sage/structure/parent.pyx", line 931:
    sage: R.unset_coercions_used()
Exception raised:
    Traceback (most recent call last):
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_22[12]>", line 1, in <module>
        R.unset_coercions_used()###line 931:
    sage: R.unset_coercions_used()
    AttributeError: 'sage.rings.polynomial.multi_polynomial_libsingular' object has no attribute 'unset_coercions_used'
**********************************************************************
File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/devel/sage-main/sage/structure/parent.pyx", line 945:
    sage: R.unset_coercions_used()
Exception raised:
    Traceback (most recent call last):
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_22[16]>", line 1, in <module>
        R.unset_coercions_used()###line 945:
    sage: R.unset_coercions_used()
    AttributeError: 'sage.rings.polynomial.multi_polynomial_libsingular' object has no attribute 'unset_coercions_used'
**********************************************************************
File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/devel/sage-main/sage/structure/parent.pyx", line 975:
    sage: K.unset_coercions_used()
Exception raised:
    Traceback (most recent call last):
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_23[5]>", line 1, in <module>
        K.unset_coercions_used()###line 975:
    sage: K.unset_coercions_used()
    AttributeError: 'PolynomialRing_integral_domain' object has no attribute 'unset_coercions_used'
**********************************************************************
File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/devel/sage-main/sage/structure/parent.pyx", line 976:
    sage: K.register_conversion(M_into_K)
Exception raised:
    Traceback (most recent call last):
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_23[6]>", line 1, in <module>
        K.register_conversion(M_into_K)###line 976:
    sage: K.register_conversion(M_into_K)
      File "parent.pyx", line 965, in sage.structure.parent.Parent.register_conversion (sage/structure/parent.c:8015)
        cpdef register_conversion(self, mor):
      File "parent.pyx", line 985, in sage.structure.parent.Parent.register_conversion (sage/structure/parent.c:7825)
        assert not self._coercions_used, "coercions must all be registered up before use"
    AssertionError: coercions must all be registered up before use
**********************************************************************
File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/devel/sage-main/sage/structure/parent.pyx", line 1016:
    sage: K.unset_coercions_used()
Exception raised:
    Traceback (most recent call last):
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_24[7]>", line 1, in <module>
        K.unset_coercions_used()###line 1016:
    sage: K.unset_coercions_used()
    AttributeError: 'NumberField_quadratic' object has no attribute 'unset_coercions_used'
**********************************************************************
File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/devel/sage-main/sage/structure/parent.pyx", line 1017:
    sage: K.register_embedding(K_into_MS)
Exception raised:
    Traceback (most recent call last):
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_24[8]>", line 1, in <module>
        K.register_embedding(K_into_MS)###line 1017:
    sage: K.register_embedding(K_into_MS)
      File "parent.pyx", line 1000, in sage.structure.parent.Parent.register_embedding (sage/structure/parent.c:8246)
        cpdef register_embedding(self, embedding):
      File "parent.pyx", line 1039, in sage.structure.parent.Parent.register_embedding (sage/structure/parent.c:8084)
        assert not self._coercions_used, "coercions must all be registered up before use"
    AssertionError: coercions must all be registered up before use
**********************************************************************
File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/devel/sage-main/sage/structure/parent.pyx", line 1022:
    sage: L.unset_coercions_used()
Exception raised:
    Traceback (most recent call last):
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_24[12]>", line 1, in <module>
        L.unset_coercions_used()###line 1022:
    sage: L.unset_coercions_used()
    AttributeError: 'NumberField_quadratic' object has no attribute 'unset_coercions_used'
**********************************************************************
File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/devel/sage-main/sage/structure/parent.pyx", line 1023:
    sage: L.register_embedding(L_into_MS)
Exception raised:
    Traceback (most recent call last):
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_24[13]>", line 1, in <module>
        L.register_embedding(L_into_MS)###line 1023:
    sage: L.register_embedding(L_into_MS)
      File "parent.pyx", line 1000, in sage.structure.parent.Parent.register_embedding (sage/structure/parent.c:8246)
        cpdef register_embedding(self, embedding):
      File "parent.pyx", line 1039, in sage.structure.parent.Parent.register_embedding (sage/structure/parent.c:8084)
        assert not self._coercions_used, "coercions must all be registered up before use"
    AssertionError: coercions must all be registered up before use
**********************************************************************
File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/devel/sage-main/sage/structure/parent.pyx", line 1025:
    sage: K.coerce_embedding()(a)
Exception raised:
    Traceback (most recent call last):
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_24[14]>", line 1, in <module>
        K.coerce_embedding()(a)###line 1025:
    sage: K.coerce_embedding()(a)
    TypeError: 'NoneType' object is not callable
**********************************************************************
File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/devel/sage-main/sage/structure/parent.pyx", line 1028:
    sage: L.coerce_embedding()(b)
Exception raised:
    Traceback (most recent call last):
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/local/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_24[15]>", line 1, in <module>
        L.coerce_embedding()(b)###line 1028:
    sage: L.coerce_embedding()(b)
    TypeError: 'NoneType' object is not callable
**********************************************************************
File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/devel/sage-main/sage/structure/parent.pyx", line 1032:
    sage: a.matrix() * b
Expected:
    [-272118       0]
    [      0    -462]
Got:
    [           0      b521155]
    [-462*b521155            0]
**********************************************************************
File "/scratch/mhansen/release/4.0.1/alpha0/sage-4.0.1.alpha0/devel/sage-main/sage/structure/parent.pyx", line 1035:
    sage: a * b.matrix()
Expected:
    [-272118       0]
    [      0    -462]
Got:
    [              0         a161099]
    [-272118*a161099               0]
**********************************************************************
4 items had failures:
   6 of  12 in __main__.example_21
   2 of  19 in __main__.example_22
   2 of   9 in __main__.example_23
   8 of  18 in __main__.example_24
***Test Failed*** 18 failures.

@mwhansen
Copy link
Contributor

Reviewer: Nick Alexander

@mwhansen
Copy link
Contributor

comment:20

Attachment: trac_5598.patch.gz

I've attached trac_5598.patch which folds the above three together and is rebased for 4.2. I believe this should pass all tests.

@mwhansen
Copy link
Contributor

Author: Robert Bradshaw

@mwhansen
Copy link
Contributor

comment:22

The faliures above were just because in the tests "unset_coercions_used" should have been "_unset_coercions_used".

All tests pass with trac_5598.patch.

@mwhansen
Copy link
Contributor

Merged: sage-4.2.alpha1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants