Ticket #13687: trac_13687_assertions.patch

File trac_13687_assertions.patch, 2.8 KB (added by Volker Braun, 10 years ago)

Updated patch

  • doc/en/bordeaux_2008/nf_galois_groups.rst

    # HG changeset patch
    # User Volker Braun <vbraun.name@gmail.com>
    # Date 1353618130 0
    # Node ID fbfd476d6a64f2ff9f6aee884147ca56680dd145
    # Parent  272bccb8688388d517fe276869e79dd55986a10e
    Clean up the assertion handling and add AbelianGroup_class docs
    
    diff --git a/doc/en/bordeaux_2008/nf_galois_groups.rst b/doc/en/bordeaux_2008/nf_galois_groups.rst
    a b  
    311311    sage: category(C)
    312312    Category of groups
    313313    sage: C.gens()
    314     [Fractional ideal class (5, a), Fractional ideal class (3, a)]
     314    (Fractional ideal class (5, a), Fractional ideal class (3, a))
    315315
    316316
    317317Arithmetic in the class group
  • sage/groups/abelian_gps/abelian_group.py

    diff --git a/sage/groups/abelian_gps/abelian_group.py b/sage/groups/abelian_gps/abelian_group.py
    a b  
    469469    """
    470470    The parent for Abelian groups with chosen generator orders.
    471471
     472    .. warning::
     473
     474        You should use :func:`AbelianGroup` to construct Abelian
     475        groups and not instantiate this class directly.
     476   
    472477    INPUT:
    473478
    474479    - ``generator_orders`` -- list of integers. The orders of the
  • sage/groups/group.pyx

    diff --git a/sage/groups/group.pyx b/sage/groups/group.pyx
    a b  
    5656            sage: G = Group(category = CommutativeAdditiveGroups())
    5757            Traceback (most recent call last):
    5858            ...
    59             AssertionError: Category of commutative additive groups is not a subcategory of Category of groups
     59            ValueError: Category of commutative additive groups is not a subcategory of Category of groups
    6060
    6161        Check for #8119::
    6262
     
    7070        if category is None:
    7171            category = Groups()
    7272        else:
    73             assert category.is_subcategory(Groups()), "%s is not a subcategory of %s"%(category, Groups())
     73            if not category.is_subcategory(Groups()):
     74                raise ValueError("%s is not a subcategory of %s"%(category, Groups()))
    7475        Parent.__init__(self, base=ZZ, gens=gens, category=category)
    7576   
    7677    def __contains__(self, x):
     
    321322        if connecting_set is None:
    322323            connecting_set = self.gens()
    323324        else:
    324             try:
    325                 for g in connecting_set:
    326                     assert g in self
    327             except AssertionError:
    328                 raise RuntimeError("Each element of the connecting set must be in the group!")
     325            if any(g not in self for g in connecting_set):
     326                raise ValueError("Each element of the connecting set must be in the group!")
    329327            connecting_set = [self(g) for g in connecting_set]
    330328        from sage.graphs.all import DiGraph
    331329        arrows = {}