From 92861ed09c0bb4b6376e5876c49f46868ee24353 Mon Sep 17 00:00:00 2001 From: Daniel Krenn Date: Fri, 28 Aug 2015 10:31:20 +0200 Subject: [PATCH] more on names/gens --- src/sage/rings/asymptotic/asymptotic_ring.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/sage/rings/asymptotic/asymptotic_ring.py b/src/sage/rings/asymptotic/asymptotic_ring.py index 690ac889eb4..a46622ba77a 100644 --- a/src/sage/rings/asymptotic/asymptotic_ring.py +++ b/src/sage/rings/asymptotic/asymptotic_ring.py @@ -1220,12 +1220,19 @@ def __classcall__(cls, growth_group, coefficient_ring, names=None, :: - sage: A. = AsymptoticRing(growth_group='x^ZZ * y^ZZ', coefficient_ring=ZZ) + sage: A. = AsymptoticRing(growth_group='x^ZZ * y^ZZ', coefficient_ring=ZZ); A + Asymptotic Ring over Integer Ring + sage: A. = AsymptoticRing(growth_group='x^ZZ * y^ZZ', coefficient_ring=ZZ) + Traceback (most recent call last): + ... + ValueError: Names 'y', 'x' do not coincide with + generators 'x', 'y' of Growth Group x^ZZ * y^ZZ. + sage: A. = AsymptoticRing(growth_group='x^ZZ * y^ZZ', coefficient_ring=ZZ) Traceback (most recent call last): ... ValueError: Names 'a', 'b' do not coincide with generators 'x', 'y' of Growth Group x^ZZ * y^ZZ. - sage: A. = AsymptoticRing(growth_group='x^ZZ * y^ZZ', coefficient_ring=ZZ) + sage: A. = AsymptoticRing(growth_group='x^ZZ * y^ZZ', coefficient_ring=ZZ) Traceback (most recent call last): ... ValueError: Names 'x', 'b' do not coincide with @@ -1235,7 +1242,7 @@ def __classcall__(cls, growth_group, coefficient_ring, names=None, ... ValueError: Name 'x' do not coincide with generators 'x', 'y' of Growth Group x^ZZ * y^ZZ. - sage: A. = AsymptoticRing(growth_group='x^ZZ * y^ZZ', coefficient_ring=ZZ) + sage: A. = AsymptoticRing(growth_group='x^ZZ * y^ZZ', coefficient_ring=ZZ) Traceback (most recent call last): ... ValueError: Names 'x', 'y', 'z' do not coincide with @@ -1245,7 +1252,7 @@ def __classcall__(cls, growth_group, coefficient_ring, names=None, from sage.rings.asymptotic.growth_group import GrowthGroup growth_group = GrowthGroup(growth_group) - strgens = list(str(g) for g in growth_group.gens_monomial()) + strgens = tuple(str(g) for g in growth_group.gens_monomial()) def format_names(N): return ('s ' if len(N) != 1 else ' ') + ', '.join("'%s'" % n for n in N) if names and not strgens: @@ -1253,7 +1260,7 @@ def format_names(N): (growth_group, format_names(names))) elif names is not None and len(names) == 1 and len(strgens) == 1: pass - elif names is not None and sorted(names) != strgens: + elif names is not None and names != strgens: raise ValueError('Name%s do not coincide with generator%s of %s.' % (format_names(names), format_names(strgens), growth_group))