Issue 1162: make sympy all tests pass in python2.6
http://code.google.com/p/sympy/issues/detail?id=1162
Comment #1 by ondrej.certik:
All patches in, and mpmath is fixed. Now we have these failures:
entrypoint: test_roots
def test_roots():
S = sympify
a = Symbol("a")
b = Symbol("b")
c = Symbol("c")
x = Symbol("x")
assert roots(x**2-3*x+2) == [1, 2]
assert roots(x**2-3*x/2+Rational(1,2)) == [Rational(1,2), 1]
assert roots(2*x**2-3*x+1) == [Rational(1,2), 1]
assert roots(x**2-1) == [1, -1]
assert roots(x**2+1) == [I, -I]
assert roots(x**3-1) == [1,
Rational(-1,2) +
I*Rational(1,2)*3**Rational(1,2),
Rational(-1,2) -
I*Rational(1,2)*3**Rational(1,2)]
assert roots(x**3) == [0, 0, 0]
assert roots(x**3-x) == [-1, 0, 1]
assert roots(Rational(2),x) == []
assert roots(a*x**2 + b*x + c, var=[x]) == \
[-b/(a*2)+(((b/a)**2-4*c/a)**Rational(1,2))/2,
E -b/(a*2)-(((b/a)**2-4*c/a)**Rational(1,2))/2]
> AssertionError: (inconsistently failed then succeeded)
/home/buildslave/Buildbot/py2.6-pure/build/sympy/polynomials/tests/test_polynomials.py:287:
AssertionError
entrypoint: test_solve_system
def test_solve_system():
x = Symbol("x")
y = Symbol("y")
z = Symbol("z")
assert solve_system(x-1) == [(S.One,)]
assert solve_system([2*x - 3, 3*y/2 - 2*x, z - 5*y]) \
== [(Rational(3, 2), Integer(2), Integer(10))]
assert solve_system([y - x, y - x - 1]) == []
assert solve_system([y - x**2, y + x**2]) == [(S.Zero, S.Zero)]
assert solve_system([y - x**2, y + x**2 + 1]) == \
[(I*Rational(1,2)**Rational(1,2), Rational(-1,2)),
E (-I*Rational(1,2)**Rational(1,2), Rational(-1,2))]
> AssertionError: (inconsistently failed then succeeded)
/home/buildslave/Buildbot/py2.6-pure/build/sympy/polynomials/tests/test_polynomials.py:334:
AssertionError
entrypoint: test_pretty_basic
def test_pretty_basic():
# Simple numbers/symbols
assert pretty( -Rational(1)/2 ) == '-1/2'
assert pretty( -Rational(13)/22 ) == ' 13\n- --\n 22'
assert pretty( oo ) == 'oo'
# Powers
assert pretty( (x**2) ) == ' 2\nx '
assert pretty( 1/x ) == '1\n-\nx'
assert pretty( y*x**-2 ) == 'y \n--\n 2\nx '
assert pretty( x**Rational(-5,2) ) == ' 1 \n----\n 5/2\nx '
assert pretty( (-2)**x ) == ' x\n(-2) '
# Sums of terms
assert pretty( (x**2 + x + 1)) in [
' 2\n1 + x + x ',
' 2 \nx + x + 1',
E ' 2 \nx + x + 1']
> assert ' 2 \nx + 1 + x' in [' 2\n1 + x + x ', '
2 \nx
+ x + 1', ' 2 \nx + x + 1']
+ where ' 2 \nx + 1 + x' = pretty((((x ** 2) + x) + 1))
/home/buildslave/Buildbot/py2.6-pure/build/sympy/printing/pretty/tests/test_pretty.py:57:
AssertionError
entrypoint: test_pretty_sqrt
def test_pretty_sqrt():
assert pretty( sqrt(2) ) == ' ___\n\\/ 2 '
assert pretty( 2**Rational(1,3) ) == '3 ___\n\\/ 2 '
E assert pretty( sqrt(x**2+1) ) == ' ________\n / 2 \n\\/ 1
+ x '
> assert ' ________\n / 2 \n\\/ x + 1 ' == ' ________\n
/ 2
\n\\/ 1 + x '
+ where ' ________\n / 2 \n\\/ x + 1 ' = pretty((x**2 +
1)**(1/2))
+ where (x**2 + 1)**(1/2) = sqrt(((x ** 2) + 1))
/home/buildslave/Buildbot/py2.6-pure/build/sympy/printing/pretty/tests/test_pretty.py:146:
AssertionError
entrypoint: test_pretty_matrix
def test_pretty_matrix():
p = pretty( Matrix([[x**2+1, 1], [y, x+y]]) )
s1 = \
"""\
[ 2 ]
[1 + x 1 ]
[ ]
[ y x + y]\
"""
s2 = \
"""\
[ 2 ]
[x + 1 1 ]
[ ]
[ y y + x]\
"""
E assert p in [s1, s2]
> assert '[ 2 ]\n[x + 1 1 ]\n[ ]\n[ y
x + y]'
in ['[ 2 ]\n[1 + x 1 ]\n[ ]\n[ y x +
y]', '[ 2
]\n[x + 1 1 ]\n[ ]\n[ y y + x]']
/home/buildslave/Buildbot/py2.6-pure/build/sympy/printing/pretty/tests/test_pretty.py:224:
AssertionError
entrypoint: test_upretty_integral
def test_upretty_integral():
u = upretty( Integral(sin(th)/cos(ph), (th,0,pi), (ph, 0, 2*pi)) )
s = \
u"""\
2⋅π π \n\
⌠⌠\n\
⎮ ⎮ sin(θ) \n\
⎮ ⎮ ────── dθ dφ\n\
⎮ ⎮ cos(φ) \n\
⌡ ⌡ \n\
0 0 \
"""
assert u == s
u = upretty( Integral(x**2*sin(y), (x,0,1), (y,0,pi)) )
s = \
u"""\
Ï€ 1 \n\
⌠⌠\n\
⎮ ⎮ 2 \n\
⎮ ⎮ x ⋅sin(y) dx dy\n\
⌡ ⌡ \n\
0 0 \
"""
E assert u == s
> assert u'\u03c0 1 \n\u2320 \u2320
\n\u23ae
\u23ae ...u23ae sin(y)\u22c5x dx dy\n\u2321 \u2321 \n0
0
' == u'\u03c0 1 \n\u2320 \u2320
\n\u23ae \u23ae
2 ...u23ae x \u22c5sin(y) dx dy\n\u2321 \u2321 \n0
0 '
/home/buildslave/Buildbot/py2.6-pure/build/sympy/printing/pretty/tests/test_pretty_unicode.py:202:
AssertionError
entrypoint: test_upretty_matrix
def test_upretty_matrix():
u = upretty( Matrix([[x**2+1, 1], [y, x+y]]) )
s1 = \
u"""\
⎡ 2 ⎤
⎢1 + x 1 ⎥
⎢ ⎥
⎣ y x + y⎦\
"""
s2 = \
u"""\
⎡ 2 ⎤
⎢x + 1 1 ⎥
⎢ ⎥
⎣ y y + x⎦\
"""
E assert u in [s1, s2]
> assert u'\u23a1 2 \u23a4\n\u23a2x + 1 1
\u23a5\n\u23a2
\u23a5\n\u23a3 y x + y\u23a6' in [u'\u23a1 2
\u23a4\n\u23a21 + x
1 \u23a5\n\u23a2 \u23a5\n\u23a3 y x + y\u23a6',
u'\u23a1 2
\u23a4\n\u23a2x + 1 1 \u23a5\n\u23a2 \u23a5\n\u23a3
y y +
x\u23a6']
/home/buildslave/Buildbot/py2.6-pure/build/sympy/printing/pretty/tests/test_pretty_unicode.py:258:
AssertionError
entrypoint: test_upretty_matrix2
def test_upretty_matrix2():
m = Matrix([[x/y, y, th], [0, exp(I*k*ph), 1]])
u = upretty(m)
s = \
u"""\
⎡x ⎤
⎢─ y θ⎥
⎢y ⎥
⎢ ⎥
⎢ ⅈ⋅k⋅φ ⎥
⎣0 ℯ 1⎦\
"""
E assert u == s
> assert u'\u23a1x \u23a4\n\u23a2\u2500 y
\u03b8\u23a5\n\u23a2y ...5\n\u23a2 k\u22c5\u03c6\u22c5\u2148
\u23a5\n\u23a30 \u212f 1\u23a6' == u'\u23a1x
\u23a4\n\u23a2\u2500
y \u03b8\u23a5\n\u23a2y ...5\n\u23a2 \u2148\u22c5k\u22c5\u03c6
\u23a5\n\u23a30 \u212f 1\u23a6'
/home/buildslave/Buildbot/py2.6-pure/build/sympy/printing/pretty/tests/test_pretty_unicode.py:273:
AssertionError
entrypoint: test_upretty_seq
def test_upretty_seq():
assert upretty([]) == '[]'
assert upretty(()) == '()'
assert upretty({}) == '{}'
assert upretty(set()) == 'set()'
assert upretty(frozenset()) == 'frozenset()'
e = [x**2, 1/x, x, y, sin(th)**2/cos(ph)**2]
u = upretty(e)
s = \
u"""\
⎡ 2 ⎤
⎢ 2 1 sin (θ)⎥
⎢x , ─, x, y, ───────⎥
⎢ x 2 ⎥
⎣ cos (φ)⎦\
"""
assert u == s
assert upretty((x,)) == '(x,)'
p = upretty((1/x,))
s = \
u"""\
⎛1 ⎞
⎜─,⎟
⎠x ⎠\
"""
assert p == s
e = tuple(e)
u = upretty(e)
s = \
u"""\
⎛ 2 ⎞
⎜ 2 1 sin (θ)⎟
⎜x , ─, x, y, ───────⎟
⎜ x 2 ⎟
⎠cos (φ)⎠\
"""
assert u == s
e_= dict(enumerate(e))
u = upretty(e_)
s = \
u"""\
⎧ 2 ⎫
⎪ 1 2 sin (θ)⎪
⎨1: ─, 0: x , 2: x, 3: y, 4: ───────⎬
⎪ x 2 ⎪
⎩ cos (φ)âŽ\
"""
E assert u == s
> assert u'\u23a7 2 \u23ab\n\u23aa 1
... 2 \u23aa\n\u23a9 cos (\u03c6)
\u23ad' == u'\u23a7 2 \u23ab\n\u23aa
1 2
... 2 \u23aa\n\u23a9 cos
(\u03c6)\u23ad'
/home/buildslave/Buildbot/py2.6-pure/build/sympy/printing/pretty/tests/test_pretty_unicode.py:330:
AssertionError
entrypoint: test_Pow
def test_Pow():
assert ccode(x**3) == "pow(x,3)"
assert ccode(x**(y**3)) == "pow(x,(pow(y,3)))"
assert ccode(1/(g(x)*3.5)**(x - y**x)/(x**2 + y)) == \
E "1/(y + pow(x,2))*pow((3.50000000000000*g(x)),(-x + pow(y,x)))"
> AssertionError: (inconsistently failed then succeeded)
/home/buildslave/Buildbot/py2.6-pure/build/sympy/printing/tests/test_ccode.py:13:
AssertionError
entrypoint: test_latex_basic
def test_latex_basic():
assert latex(1+x) == "$1 + x$"
assert latex(x**2) == "${x}^{2}$"
assert latex(x**(1+x)) == "${x}^{1 + x}$"
E assert latex(x**3+x+1+x**2) == "$1 + x + {x}^{2} + {x}^{3}$"
> assert '${x}^{2} + {x}^{3} + 1 + x$' == '$1 + x + {x}^{2} +
{x}^{3}$'
+ where '${x}^{2} + {x}^{3} + 1 + x$' = latex(((((x ** 3) + x) +
1) + (x **
2)))
/home/buildslave/Buildbot/py2.6-pure/build/sympy/printing/tests/test_latex.py:16:
AssertionError
entrypoint: test_latex_functions
def test_latex_functions():
assert latex(exp(x)) == "${e}^{x}$"
E assert latex(exp(1)+exp(2)) == "$e + {e}^{2}$"
> assert '${e}^{2} + e$' == '$e + {e}^{2}$'
+ where '${e}^{2} + e$' = latex((E + exp(2)))
+ where E = exp(1)
+ and exp(2) = exp(2)
/home/buildslave/Buildbot/py2.6-pure/build/sympy/printing/tests/test_latex.py:35:
AssertionError
entrypoint: test_latex_derivatives
def test_latex_derivatives():
assert latex(diff(x**3, x, evaluate=False)) == \
r"$\frac{\partial}{\partial x} {x}^{3}$"
assert latex(diff(sin(x)+x**2, x, evaluate=False)) == \
E r"$\frac{\partial}{\partial
x}\left(\operatorname{sin}\left(x\right) +
{x}^{2}\right)$"
> AssertionError: (inconsistently failed then succeeded)
/home/buildslave/Buildbot/py2.6-pure/build/sympy/printing/tests/test_latex.py:61:
AssertionError
entrypoint: test_latex_dict
def test_latex_dict():
d = {Rational(1): 1, x**2: 2, x: 3, x**3: 4}
E assert latex(d) == '$\\begin{Bmatrix}1 : 1, & x : 3, & {x}^{2} : 2,
& {x}^{3}
: 4\\end{Bmatrix}$'
> assert '$\\begin{Bmatrix}{x}^{2} : 2, & {x}^{3} : 4, & 1 : 1, & x :
3\\end{Bmatrix}$' == '$\\begin{Bmatrix}1 : 1, & x : 3, & {x}^{2} : 2, &
{x}^{3} :
4\\end{Bmatrix}$'
+ where '$\\begin{Bmatrix}{x}^{2} : 2, & {x}^{3} : 4, & 1 : 1, &
x :
3\\end{Bmatrix}$' = latex({x: 3, x**2: 2, x**3: 4, 1: 1})
/home/buildslave/Buildbot/py2.6-pure/build/sympy/printing/tests/test_latex.py:91:
AssertionError
entrypoint: test_python_basic
def test_python_basic():
# Simple numbers/symbols
assert python(-Rational(1)/2) == "e = Rational(-1, 2)"
assert python(-Rational(13)/22) == "e = Rational(-13, 22)"
assert python(oo) == "e = oo"
# Powers
assert python((x**2)) == "x = Symbol(\'x\')\ne = x**2"
assert python(1/x) == "x = Symbol('x')\ne = 1/x"
assert python(y*x**-2) == "y = Symbol('y')\nx = Symbol('x')\ne =
y/x**2"
assert python(x**Rational(-5, 2)) == "x = Symbol('x')\ne =
x**(Rational(-5, 2))"
# Sums of terms
assert python((x**2 + x + 1)) in [
"x = Symbol('x')\ne = 1 + x + x**2",
"x = Symbol('x')\ne = x + x**2 + 1",
E "x = Symbol('x')\ne = x**2 + x + 1",]
> assert "x = Symbol('x')\ne = x**2 + 1 + x" in ["x = Symbol('x')\ne
= 1 + x +
x**2", "x = Symbol('x')\ne = x + x**2 + 1", "x = Symbol('x')\ne = x**2 + x
+ 1"]
+ where "x = Symbol('x')\ne = x**2 + 1 + x" = python((((x ** 2) +
x) + 1))
/home/buildslave/Buildbot/py2.6-pure/build/sympy/printing/tests/test_python.py:28:
AssertionError
entrypoint: test_python_functions
def test_python_functions():
# Simple
E assert python((2*x + exp(x))) in "x = Symbol('x')\ne = 2*x + exp(x)"
> assert "x = Symbol('x')\ne = exp(x) + 2*x" in "x = Symbol('x')\ne =
2*x + exp(x)"
+ where "x = Symbol('x')\ne = exp(x) + 2*x" = python(((2 * x) +
exp(x)))
+ where exp(x) = exp(x)
/home/buildslave/Buildbot/py2.6-pure/build/sympy/printing/tests/test_python.py:70:
AssertionError
entrypoint: test_Add
def test_Add():
assert str(x+y) == "x + y"
assert str(x+1) == "1 + x"
E assert str(x+x**2) == "x + x**2"
> assert 'x**2 + x' == 'x + x**2'
+ where 'x**2 + x' = str((x + (x ** 2)))
/home/buildslave/Buildbot/py2.6-pure/build/sympy/printing/tests/test_str.py:32:
AssertionError
entrypoint: test_Poly
def test_Poly():
assert str(Poly(0, x)) == "Poly(0, x)"
assert str(Poly(1, x)) == "Poly(1, x)"
assert str(Poly(x, x)) == "Poly(x, x)"
assert str(Poly(2*x + 1, x)) == "Poly(2*x + 1, x)"
assert str(Poly(2*x - 1, x)) == "Poly(2*x - 1, x)"
assert str(Poly(-1, x)) == "Poly(-1, x)"
assert str(Poly(-x, x)) == "Poly(-x, x)"
assert str(Poly(-2*x + 1, x)) == "Poly(-2*x + 1, x)"
assert str(Poly(-2*x - 1, x)) == "Poly(-2*x - 1, x)"
assert str(Poly(x - 1, x, order='lex')) == "Poly(x - 1, x)"
assert str(Poly(x**2 + 1 + y, x)) == "Poly(x**2 + 1 + y, x)"
E assert str(Poly(x**2 - 1 + y, x)) == "Poly(x**2 - 1 + y, x)"
> assert 'Poly(x**2 + y - 1, x)' == 'Poly(x**2 - 1 + y, x)'
+ where 'Poly(x**2 + y - 1, x)' = str(Poly(x**2 + y - 1, x))
+ where Poly(x**2 + y - 1, x) = Poly((((x ** 2) - 1) + y), x)
/home/buildslave/Buildbot/py2.6-pure/build/sympy/printing/tests/test_str.py:187:
AssertionError
entrypoint: test_set
def test_set():
assert spr(set()) == 'set()'
assert spr(frozenset()) == 'frozenset()'
assert spr(set([1,2,3]))== 'set([1, 2, 3])'
E assert spr(set([1,x,x**2,x**3,x**4])) == 'set([1, x, x**2, x**3,
x**4])'
> assert 'set([x**2, x**3, x**4, 1, x])' == 'set([1, x, x**2, x**3,
x**4])'
+ where 'set([x**2, x**3, x**4, 1, x])' = spr(set([x, x**2, x**3,
x**4, 1]))
+ where set([x, x**2, x**3, x**4, 1]) = set([1, x, x**2, x**3,
x**4])
/home/buildslave/Buildbot/py2.6-pure/build/sympy/printing/tests/test_str.py:288:
AssertionError
entrypoint: test_wild_str
def test_wild_str():
# Check expressions containing Wild not causing infinite recursion
w = Wild('x')
assert str(w + 1) == '1 + x_'
E assert str(exp(2**w) + 5) == '5 + exp(2**x_)'
> assert 'exp(2**x_) + 5' == '5 + exp(2**x_)'
+ where 'exp(2**x_) + 5' = str((exp(2**x_) + 5))
+ where exp(2**x_) = exp((2 ** x_))
/home/buildslave/Buildbot/py2.6-pure/build/sympy/printing/tests/test_str.py:322:
AssertionError
entrypoint: test_bug4
def test_bug4():
e = -2*sqrt(x)-y/sqrt(x)/2
assert str(e) not in ["(-2)*x**1/2(-1/2)*x**(-1/2)*y",
"-2*x**1/2(-1/2)*x**(-1/2)*y","-2*x**1/2-1/2*x**-1/2*w"]
assert str(e) in ["-2*x**(1/2) - 1/2*x**(-1/2)*y", "-2*x**(1/2) -
1/2*y*x**(-1/2)",
"-1/2*x**(-1/2)*y -
2*x**(1/2)", "-1/2*y*x**(-1/2) -
2*x**(1/2)",
E "-2*x**(1/2) - y/(2*x**(1/2))"]
> assert '-y/(2*x**(1/2)) - 2*x**(1/2)' in ['-2*x**(1/2) -
1/2*x**(-1/2)*y',
'-2*x**(1/2) - 1/2*y*x**(-1/2)', '-1/2*x**(-1/2)*y -
2*x**(1/2)', '-1/2*y*x**(-1/2) -
2*x**(1/2)', '-2*x**(1/2) - y/(2*x**(1/2))']
+ where '-y/(2*x**(1/2)) - 2*x**(1/2)' = str(-y/(2*x**(1/2)) -
2*x**(1/2))
/home/buildslave/Buildbot/py2.6-pure/build/sympy/printing/tests/test_str.py:347:
AssertionError
entrypoint: test_solve_poly_system
def test_solve_poly_system():
assert solve_poly_system([x-1], x) == [(S.One,)]
assert solve_poly_system([y - x, y - x - 1], x, y) == None
assert solve_poly_system([y - x**2, y + x**2], x, y) == [(S.Zero,
S.Zero)]
assert solve_poly_system([2*x - 3, 3*y/2 - 2*x, z - 5*y], x, y, z)
== \
[(Rational(3, 2), Integer(2), Integer(10))]
assert solve_poly_system([x*y - 2*y, 2*y**2 - x**2], x, y) == \
[(0, 0), (2, -2**S.Half), (2, 2**S.Half)]
assert solve_poly_system([y - x**2, y + x**2 + 1], x, y) == \
E [(I*S.Half**S.Half, -S.Half), (-I*S.Half**S.Half, -S.Half)]
> AssertionError: (inconsistently failed then succeeded)
/home/buildslave/Buildbot/py2.6-pure/build/sympy/solvers/tests/test_polysys.py:21:
AssertionError
*** XPASS ***
XPASS: test_plotting
XPASS: test_trim_xfail
tests finished: 1183 passed, 2 xpass, 34 xfail, 22 failed, 4 skipped in
73.25 seconds
DO *NOT* COMMIT!
Issue attribute updates:
Labels: -NeedsReview
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en
-~----------~----~----~----~------~----~------~--~---