def test01():
    ex:=(2/3)**(1/5).
    res=ex.mma_form()
    assert(res=="(2/3)^(1/5)")
    res=ex.sympy_form()
    assert(res=="(2/3)**(1/5)")
    res=ex.input_form()
    assert(res=="( 2/3 )**( 1/5 )")
    print("Test 01 passed")

test01()

def test02():
    ex:=(2/3 p q)**(2 a + b);
    res=ex.mma_form()
    assert(res=="(2/3*p*q)^((2*a+b))")
    res=ex.sympy_form()
    assert(res=="(2/3*p*q)**((2*a+b))")
    print("Test 02 passed")

test02()

def test03():
    c::Integer;
    ex:=(a**b)**c;
    res=ex.input_form();
    assert(res=="(a)**(b c)")
    res=ex.mma_form();
    assert(res=="(a)^((b*c))")
    res=ex.sympy_form();
    assert(res=="(a)**((b*c))")
    print("Test 03 passed")

test03()

def test04():
    ex:=a**(-4) + a**(2 b);
    res=ex.input_form();
    assert(res=="(a)**(-4) + (a)**(2b)");
    ex:=a**(-b) + a**( 2/3 );
    res=ex.input_form();
    assert(res=="(a)**(-b) + (a)**( 2/3 )");
    print("Test 04 passed")

test04()

def test05():
    __cdbkernel__=create_scope()
    ket{A??}::LaTeXForm("|", A??, "\rangle");
    ex:= a ket{n};
    res=ex._latex_();
    assert(res==r"a |n\rangle")
    print("Test 05a passed")
    Q{A??}::LaTeXForm("R");
    ex:= b Q{n};
    res=ex._latex_();
    assert(res==r"b R\left(n\right)")
    T{A??}::LaTeXForm(T_{A??});
    ex:= b T{n_{1}};
    res=ex._latex_();
    assert(res==r"b T_{n_{1}}")
    print("Test 05b passed")
    
test05()
