Пример #1
0
def test_Domain_postprocess():
    raises(GeneratorsError, lambda: Domain.postprocess({'gens': (x, y),
           'domain': ZZ[y, z]}))

    raises(GeneratorsError, lambda: Domain.postprocess({'gens': (),
           'domain': EX}))
    raises(GeneratorsError, lambda: Domain.postprocess({'domain': EX}))
def test_Domain_postprocess():
    raises(GeneratorsError, lambda: Domain.postprocess({'gens': (x, y),
           'domain': ZZ[y, z]}))

    raises(GeneratorsError, lambda: Domain.postprocess({'gens': (),
           'domain': EX}))
    raises(GeneratorsError, lambda: Domain.postprocess({'domain': EX}))
Пример #3
0
def test_Domain_preprocess():
    assert Domain.preprocess(ZZ) == ZZ
    assert Domain.preprocess(QQ) == QQ
    assert Domain.preprocess(EX) == EX
    assert Domain.preprocess(FF(2)) == FF(2)
    assert Domain.preprocess(ZZ[x, y]) == ZZ[x, y]

    assert Domain.preprocess('Z') == ZZ
    assert Domain.preprocess('Q') == QQ

    assert Domain.preprocess('ZZ') == ZZ
    assert Domain.preprocess('QQ') == QQ

    assert Domain.preprocess('EX') == EX

    assert Domain.preprocess('FF(23)') == FF(23)
    assert Domain.preprocess('GF(23)') == GF(23)

    raises(OptionError, lambda: Domain.preprocess('Z[]'))

    assert Domain.preprocess('Z[x]') == ZZ[x]
    assert Domain.preprocess('Q[x]') == QQ[x]

    assert Domain.preprocess('ZZ[x]') == ZZ[x]
    assert Domain.preprocess('QQ[x]') == QQ[x]

    assert Domain.preprocess('Z[x,y]') == ZZ[x, y]
    assert Domain.preprocess('Q[x,y]') == QQ[x, y]

    assert Domain.preprocess('ZZ[x,y]') == ZZ[x, y]
    assert Domain.preprocess('QQ[x,y]') == QQ[x, y]

    raises(OptionError, lambda: Domain.preprocess('Z()'))

    assert Domain.preprocess('Z(x)') == ZZ.frac_field(x)
    assert Domain.preprocess('Q(x)') == QQ.frac_field(x)

    assert Domain.preprocess('ZZ(x)') == ZZ.frac_field(x)
    assert Domain.preprocess('QQ(x)') == QQ.frac_field(x)

    assert Domain.preprocess('Z(x,y)') == ZZ.frac_field(x, y)
    assert Domain.preprocess('Q(x,y)') == QQ.frac_field(x, y)

    assert Domain.preprocess('ZZ(x,y)') == ZZ.frac_field(x, y)
    assert Domain.preprocess('QQ(x,y)') == QQ.frac_field(x, y)

    assert Domain.preprocess('Q<I>') == QQ.algebraic_field(I)
    assert Domain.preprocess('QQ<I>') == QQ.algebraic_field(I)

    assert Domain.preprocess('Q<sqrt(2), I>') == QQ.algebraic_field(sqrt(2), I)
    assert Domain.preprocess(
        'QQ<sqrt(2), I>') == QQ.algebraic_field(sqrt(2), I)

    raises(OptionError, lambda: Domain.preprocess('abc'))
Пример #4
0
def test_Domain_preprocess():
    assert Domain.preprocess(ZZ) == ZZ
    assert Domain.preprocess(QQ) == QQ
    assert Domain.preprocess(EX) == EX
    assert Domain.preprocess(FF(2)) == FF(2)
    assert Domain.preprocess(ZZ[x, y]) == ZZ[x, y]

    assert Domain.preprocess('Z') == ZZ
    assert Domain.preprocess('Q') == QQ

    assert Domain.preprocess('ZZ') == ZZ
    assert Domain.preprocess('QQ') == QQ

    assert Domain.preprocess('EX') == EX

    assert Domain.preprocess('FF(23)') == FF(23)
    assert Domain.preprocess('GF(23)') == GF(23)

    raises(OptionError, lambda: Domain.preprocess('Z[]'))

    assert Domain.preprocess('Z[x]') == ZZ[x]
    assert Domain.preprocess('Q[x]') == QQ[x]

    assert Domain.preprocess('ZZ[x]') == ZZ[x]
    assert Domain.preprocess('QQ[x]') == QQ[x]

    assert Domain.preprocess('Z[x,y]') == ZZ[x, y]
    assert Domain.preprocess('Q[x,y]') == QQ[x, y]

    assert Domain.preprocess('ZZ[x,y]') == ZZ[x, y]
    assert Domain.preprocess('QQ[x,y]') == QQ[x, y]

    raises(OptionError, lambda: Domain.preprocess('Z()'))

    assert Domain.preprocess('Z(x)') == ZZ.frac_field(x)
    assert Domain.preprocess('Q(x)') == QQ.frac_field(x)

    assert Domain.preprocess('ZZ(x)') == ZZ.frac_field(x)
    assert Domain.preprocess('QQ(x)') == QQ.frac_field(x)

    assert Domain.preprocess('Z(x,y)') == ZZ.frac_field(x, y)
    assert Domain.preprocess('Q(x,y)') == QQ.frac_field(x, y)

    assert Domain.preprocess('ZZ(x,y)') == ZZ.frac_field(x, y)
    assert Domain.preprocess('QQ(x,y)') == QQ.frac_field(x, y)

    assert Domain.preprocess('Q<I>') == QQ.algebraic_field(I)
    assert Domain.preprocess('QQ<I>') == QQ.algebraic_field(I)

    assert Domain.preprocess('Q<sqrt(2), I>') == QQ.algebraic_field(sqrt(2), I)
    assert Domain.preprocess('QQ<sqrt(2), I>') == QQ.algebraic_field(
        sqrt(2), I)

    raises(OptionError, lambda: Domain.preprocess('abc'))
Пример #5
0
def test_Domain_preprocess():
    assert Domain.preprocess(ZZ) == ZZ
    assert Domain.preprocess(QQ) == QQ
    assert Domain.preprocess(EX) == EX
    assert Domain.preprocess(FF(2)) == FF(2)
    assert Domain.preprocess(ZZ[x, y]) == ZZ[x, y]

    assert Domain.preprocess("Z") == ZZ
    assert Domain.preprocess("Q") == QQ

    assert Domain.preprocess("ZZ") == ZZ
    assert Domain.preprocess("QQ") == QQ

    assert Domain.preprocess("EX") == EX

    assert Domain.preprocess("FF(23)") == FF(23)
    assert Domain.preprocess("GF(23)") == GF(23)

    raises(OptionError, "Domain.preprocess('Z[]')")

    assert Domain.preprocess("Z[x]") == ZZ[x]
    assert Domain.preprocess("Q[x]") == QQ[x]

    assert Domain.preprocess("ZZ[x]") == ZZ[x]
    assert Domain.preprocess("QQ[x]") == QQ[x]

    assert Domain.preprocess("Z[x,y]") == ZZ[x, y]
    assert Domain.preprocess("Q[x,y]") == QQ[x, y]

    assert Domain.preprocess("ZZ[x,y]") == ZZ[x, y]
    assert Domain.preprocess("QQ[x,y]") == QQ[x, y]

    raises(OptionError, "Domain.preprocess('Z()')")

    assert Domain.preprocess("Z(x)") == ZZ.frac_field(x)
    assert Domain.preprocess("Q(x)") == QQ.frac_field(x)

    assert Domain.preprocess("ZZ(x)") == ZZ.frac_field(x)
    assert Domain.preprocess("QQ(x)") == QQ.frac_field(x)

    assert Domain.preprocess("Z(x,y)") == ZZ.frac_field(x, y)
    assert Domain.preprocess("Q(x,y)") == QQ.frac_field(x, y)

    assert Domain.preprocess("ZZ(x,y)") == ZZ.frac_field(x, y)
    assert Domain.preprocess("QQ(x,y)") == QQ.frac_field(x, y)

    assert Domain.preprocess("Q<I>") == QQ.algebraic_field(I)
    assert Domain.preprocess("QQ<I>") == QQ.algebraic_field(I)

    assert Domain.preprocess("Q<sqrt(2), I>") == QQ.algebraic_field(sqrt(2), I)
    assert Domain.preprocess("QQ<sqrt(2), I>") == QQ.algebraic_field(sqrt(2), I)

    raises(OptionError, "Domain.preprocess('abc')")