Ticket #6436 (closed defect: fixed)

Opened 14 months ago

Last modified 14 months ago

[with patch, positive review] ideal([]) gives unhelpful error message

Reported by: broune Owned by: tbd
Priority: major Milestone: sage-4.1
Component: algebra Keywords:
Cc: Author(s): Bjarke Hammersholt Roune
Report Upstream: Reviewer(s): John Palmieri
Merged in: sage-4.1.rc0 Work issues:

Description

When I type "ideal([])" in Sage 4.0.1 I get an error message intended for a different case:

sage: ideal([])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
...
TypeError: unable to find common ring into which all ideal generators map

This error message is incorrect since, trivially, the empty set of generators will map into any ring at all. The attached patch changes this to

sage: ideal([])
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
...
ValueError: unable to determine which ring to embed the ideal in

By the way, the function ideal in ideal.py has a documentation section named TESTS with doctests in it. As far as I can determine, these doctests do not get run.

Attachments

ideal_empty_list.patch Download (1.5 KB) - added by broune 14 months ago.
ref_6436.patch Download (1.0 KB) - added by jhpalmieri 14 months ago.

Change History

Changed 14 months ago by broune

Changed 14 months ago by jhpalmieri

  • reviewer set to John Palmieri
  • summary changed from ideal([]) gives unhelpful error message to [with patch, positive review] ideal([]) gives unhelpful error message
  • author set to Bjarke Hammersholt Roune

By the way, the function ideal in ideal.py has a documentation section named TESTS with doctests in it. As far as I can determine, these doctests do not get run.

I'm not sure why you say this. If you add lines like

sage: 3+5
9

to that section, you get a doctest failure. At least, I do. I think that your addition to that section doesn't produce an error because it starts with Sage:, not sage:. Since you already test this failure earlier, I'm adding a referee's patch deleting this non-doctest from the TESTS section, and also fixing a small reST issue.

Changed 14 months ago by jhpalmieri

Changed 14 months ago by rlm

  • status changed from new to closed
  • resolution set to fixed
  • merged set to sage-4.1.rc0
Note: See TracTickets for help on using tickets.