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_move_to_next_list(cursor): elems = from_latex(r"\frac{3}{2}") cursor.reparent(elems[0].numerator, -1) cursor.handle_movement(Direction.RIGHT) assert cursor.owner is elems[0].denominator assert cursor.pos == 0
def test_move_to_previous_list(cursor): elems = from_latex(r"\frac{3}{2}") cursor.reparent(elems[0].denominator, 0) cursor.handle_movement(Direction.LEFT) assert cursor.owner is elems[0].numerator assert cursor.pos == 1
def test_handle_movement_down_out(cursor): elems = from_latex(r"\abs{x}") cursor.reparent(elems[0].argument, -1) cursor.handle_movement(Direction.DOWN) assert cursor.owner is elems assert cursor.pos == 1