def test_add_to_super_before_alternative(cursor): elems = from_latex("xy^{z}") cursor.reparent(elems, 2) cursor.handle_movement(Direction.LEFT, select=True) cursor.insert_superscript_subscript() assert elems.to_latex() == "x^{yz}" assert cursor.owner is elems[1].exponent
def test_add_to_super_after(cursor): elems = from_latex("x^{2}2") cursor.reparent(elems, -1) cursor.handle_movement(Direction.LEFT, select=True) cursor.insert_superscript_subscript() assert elems.to_latex() == "x^{22}" assert cursor.owner is elems[1].exponent
def test_add_super_to_sub(cursor): elems = from_latex("x_{3}") cursor.reparent(elems, -1) cursor.insert_superscript_subscript(superscript=True) assert elems.to_latex() == "x_{3}^{}" assert cursor.owner is elems[1].exponent
def test_add_sub_to_super(cursor): elems = from_latex("x^{3}") cursor.reparent(elems, -1) cursor.insert_superscript_subscript(superscript=False) assert elems.to_latex() == "x_{}^{3}" assert cursor.owner is elems[1].subscript
def test_move_to_super_before(cursor): elems = from_latex("x^{2}") cursor.reparent(elems, 1) cursor.insert_superscript_subscript() assert elems.to_latex() == "x^{2}" assert cursor.owner is elems[1].exponent
def test_insert_empty_super(cursor): elems = from_latex("x") cursor.reparent(elems, -1) cursor.insert_superscript_subscript() assert elems.to_latex() == r"x^{}" assert cursor.owner is elems[1].exponent