Opened 11 years ago

Closed 10 years ago

#12084 closed defect (fixed)

Restores a test in sage/tests/french_book/number_theory.py

Reported by: roed Owned by: AlexGhitza
Priority: minor Milestone: sage-5.0
Component: basic arithmetic Keywords:
Cc: zimmerma Merged in: sage-5.0.beta0
Authors: David Roe Reviewers: David Loeffler
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

Ticket #8334 inappropriately changed the following test in sage/tests/french_book/number_theory.py:

sage: R = GF(9,name='x'); R
Finite Field in x of size 3^2
sage: Q.<x> = PolynomialRing(GF(3))
sage: R2 = GF(9,name='x',modulus=x^2+1); R2
Finite Field in x of size 3^2
sage: p = R(x+1); R2(p)
Traceback (most recent call last):
...
TypeError: unable to coerce from a finite field other than the prime subfield

to instead raise a NotImplementedError. The original behavior was restored in #8335, but that ticket has stagnated.

We add a patch to restore the original error message and type.

Attachments (1)

12084.patch (1.7 KB) - added by roed 10 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 11 years ago by roed

  • Status changed from new to needs_review

comment:2 Changed 11 years ago by zimmerma

thank you David. I will review that ticket during the Sage-Flint days, unless someone beats me.

Paul

PS: btw, please use different tickets to solve different issues

comment:3 Changed 10 years ago by davidloeffler

  • Status changed from needs_review to needs_work
File "/storage/masiao/sage-4.8.alpha5/devel/sage-testing/sage/rings/finite_rings/finite_field_givaro.py", line 327:
    sage: F81(F9.gen())
Expected:
    Traceback (most recent call last):
    ...
    NotImplementedError
Got:
    Traceback (most recent call last):
      File "/storage/masiao/sage-4.8.alpha5/local/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/storage/masiao/sage-4.8.alpha5/local/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/storage/masiao/sage-4.8.alpha5/local/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_6[50]>", line 1, in <module>
        F81(F9.gen())###line 327:
    sage: F81(F9.gen())
      File "parent.pyx", line 984, in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:7320)
      File "parent.pyx", line 2149, in sage.structure.parent.Parent.convert_map_from (sage/structure/parent.c:14043)
      File "parent.pyx", line 2156, in sage.structure.parent.Parent.discover_convert_map_from (sage/structure/parent.c:14194)
      File "parent.pyx", line 2013, in sage.structure.parent.Parent.coerce_map_from (sage/structure/parent.c:12824)
      File "parent.pyx", line 2064, in sage.structure.parent.Parent.discover_coerce_map_from (sage/structure/parent.c:13220)
      File "parent_old.pyx", line 501, in sage.structure.parent_old.Parent._coerce_map_from_ (sage/structure/parent_old.c:6047)
      File "/storage/masiao/sage-4.8.alpha5/local/lib/python/site-packages/sage/rings/finite_rings/finite_field_givaro.py", line 357, in _coerce_map_from_
        raise TypeError, "unable to coerce from a finite field other than the prime subfield"
    TypeError: unable to coerce from a finite field other than the prime subfield

comment:4 Changed 10 years ago by zimmerma

  • Status changed from needs_work to needs_info

David, on top of 4.7.2 it works for me:

[zimmerma@coing finite_rings]$ sage -t finite_field_givaro.py
sage -t  "devel/sage-12084/sage/rings/finite_rings/finite_field_givaro.py"
         [4.8 s]
 
----------------------------------------------------------------------
All tests passed!
Total time for all tests: 4.8 seconds

Did you apply another patch which would be in conflict with that one?

Paul

comment:5 Changed 10 years ago by davidloeffler

No, this is in a fresh build of 4.8.alpha5 with no patches applied. Moreover I can't see how it *can* work, in any version, since #8334 added a doctest to finite_field_givaro which expects the NotImplementedError?, and the patch here changes the NotImplementedError? back to a TypeError? but does not change this doctest.

Changed 10 years ago by roed

comment:6 Changed 10 years ago by roed

  • Status changed from needs_info to needs_review

I've updated the patch to change that doctest.

comment:7 Changed 10 years ago by davidloeffler

  • Reviewers set to David Loeffler
  • Status changed from needs_review to positive_review

comment:8 Changed 10 years ago by davidloeffler

  • Milestone changed from sage-4.8 to sage-5.0

comment:9 Changed 10 years ago by jdemeyer

  • Merged in set to sage-5.0.beta0
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.