from symengine.sympy_compat import (Integer, Rational, S, Basic, Add, Mul,
    Pow, symbols, Symbol, log, sin, zeros, atan2)

def test_Integer():
    i = Integer(5)
    assert isinstance(i, Integer)
    assert isinstance(i, Rational)
    assert isinstance(i, Basic)
    assert i.p == 5
    assert i.q == 1

def test_Rational():
    i = S(1)/2
    assert isinstance(i, Rational)
    assert isinstance(i, Basic)
    assert i.p == 1
    assert i.q == 2

def test_Add():
    x, y = symbols("x y")
    i = Add(x, x)
    assert isinstance(i, Mul)
    i = Add(x, y)
    assert isinstance(i, Add)
    assert isinstance(i, Basic)

def test_Mul():
    x, y = symbols("x y")
    i = Mul(x, x)
    assert isinstance(i, Pow)
    i = Mul(x, y)
    assert isinstance(i, Mul)
    assert isinstance(i, Basic)

def test_Pow():
    x = symbols("x")
    i = Pow(x, 1)
    assert isinstance(i, Symbol)
    i = Pow(x, 2)
    assert isinstance(i, Pow)
    assert isinstance(i, Basic)

def test_sin():
    x = symbols("x")
    i = sin(0)
    assert isinstance(i, Integer)
    i = sin(x)
    assert isinstance(i, sin)

def test_log():
    x, y = symbols("x y")
    i = log(x, y)
    assert isinstance(i, Mul)
    i = log(x)
    assert isinstance(i, log)

def test_ATan2():
    x, y = symbols("x y")
    i = atan2(x, y)
    assert isinstance(i, atan2)
    i = atan2(0, 1)
    assert i == 0

def test_zeros():
    assert zeros(3, c=2).shape == (3, 2)

def test_has_functions_module():
    import symengine.sympy_compat as sp
    assert sp.functions.sin(0) == 0

@@ -116,18 +116,26 @@
 s, atan2
+, Number
 )%0A
-
 %0Adef tes
@@ -227,32 +227,65 @@
 ce(i, Rational)%0A
+    assert isinstance(i, Number)%0A
     assert isins
@@ -404,32 +404,65 @@
 ce(i, Rational)%0A
+    assert isinstance(i, Number)%0A
     assert isins
@@ -497,16 +497,16 @@
 .p == 1%0A
-
     asse
@@ -516,16 +516,113 @@
 i.q == 2
+%0A    x = symbols(%22x%22)%0A    assert not isinstance(x, Rational)%0A    assert not isinstance(x, Number)
 %0A%0Adef te
@@ -1694,12 +1694,573 @@
 sin(0) == 0%0A
+%0Adef subclass_symbol():%0A    # Subclass of Symbol with an extra attribute%0A    class Wrapper(Symbol):%0A        def __new__(cls, name, extra_attribute):%0A            return Symbol.__new__(cls, name)%0A%0A        def __init__(self, name, extra_attribute):%0A            super(Wrapper, self).__init__(name)%0A            self.extra_attribute = extra_attribute%0A%0A    # Instantiate the subclass%0A    x = Wrapper(%22x%22, extra_attribute=3)%0A    assert x.extra_attribute == 3%0A    two_x = 2 * x%0A    # Check that after arithmetic, same subclass is returned%0A    assert two_x.args%5B1%5D is x%0A%0A

Add tests for sympy_compat