Opened 12 years ago

Closed 12 years ago

## #9336 closed defect (fixed)

# Improve doctest coverage for sage/rings/number_field

Reported by: | David Loeffler | Owned by: | David Loeffler |
---|---|---|---|

Priority: | major | Milestone: | sage-4.5.2 |

Component: | number fields | Keywords: | doctest |

Cc: | John Cremona | Merged in: | sage-4.5.2.alpha0 |

Authors: | David Loeffler | Reviewers: | John Cremona, Francis Clarke |

Report Upstream: | N/A | Work issues: | |

Branch: | Commit: | ||

Dependencies: | Stopgaps: |

### Description (last modified by )

The patch below adds about 50 new doctests in sage/rings/number_field, particularly in the files maps.py, morphism.py and number_field_morphisms.pyx.

### Attachments (1)

### Change History (9)

### comment:1 Changed 12 years ago by

Description: | modified (diff) |
---|

### comment:2 Changed 12 years ago by

Status: | new → needs_review |
---|

### comment:3 Changed 12 years ago by

Authors: | → David Loeffler |
---|---|

Reviewers: | → John Cremona |

Status: | needs_review → positive_review |

### comment:4 Changed 12 years ago by

Status: | positive_review → needs_work |
---|

Just one little niggle: according to the developer's guide, code like

try: return self.list()[0] except: raise ValueError, "Set is empty"

(lines 91 to 94 in the patched morphism.py) should be avoided. Better would be

try: return self[0] except IndexError: raise ValueError, "Set is empty"

### comment:6 follow-up: 7 Changed 12 years ago by

Status: | needs_work → needs_review |
---|

Here's a new patch, which explicitly checks whether the length of the list is 0 rather than using try/except.

### comment:7 Changed 12 years ago by

Reviewers: | John Cremona → John Cremona, Francis Clarke |
---|---|

Status: | needs_review → positive_review |

### comment:8 Changed 12 years ago by

Merged in: | → sage-4.5.2.alpha0 |
---|---|

Resolution: | → fixed |

Status: | positive_review → closed |

**Note:**See TracTickets for help on using tickets.

Good job! Patch applies to 4.4.4 and tests pass and docs build fine.

After this the number_fields directory scores as follows: