Make Pow able not to sympify.
[sympyx.git] / test_basic2.py
blob2a24d20285357133043f642596da354e91c35d8b
1 from sympy import Symbol, Integer
3 import py
5 x = Symbol("x")
6 y = Symbol("y")
7 z = Symbol("z")
9 # basic sympy objects
10 basic_objs = [
11 Integer(2),
14 pow(x,y)*y,
17 # all supported objects
18 all_objs = basic_objs + [
22 def dotest(s):
23 for x in all_objs:
24 for y in all_objs:
25 s(x,y)
27 def test_basic1():
28 def s(a,b):
29 x = a
30 x = +a
31 x = -a
32 x = a+b
33 x = a-b
34 x = a*b
35 x = a/b
36 x = a**b
37 dotest(s)
39 def test_ibasic():
40 def s(a,b):
41 x = a
42 x += b
43 x = a
44 x -= b
45 x = a
46 x *= b
47 x = a
48 x /= b
49 dotest(s)
51 def xtest_basic_nostr():
52 for obj in basic_objs:
53 for op in ['+','-','*','/','**']:
54 py.test.raises(TypeError, "obj %s '1'" % op)
56 def test_len():
57 e = x*y
58 assert len(e.args) == 2
59 e = x+y+z
60 assert len(e.args) == 3
62 def test_args():
63 assert (x*y).args[:] in ((x, y), (y, x))
64 assert (x+y).args[:] in ((x, y), (y, x))
65 assert (x*y+1).args[:] in ((x*y, 1), (1, x*y))
66 #assert sin(x*y).args[:] == (x*y,)
67 #assert sin(x*y).args[0] == x*y
68 assert (x**y).args[:] == (x,y)
69 assert (x**y).args[0] == x
70 assert (x**y).args[1] == y