aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/prompt-toolkit/py3/tests/test_buffer.py
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-02-10 16:44:39 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:39 +0300
commite9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch)
tree64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/python/prompt-toolkit/py3/tests/test_buffer.py
parent2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff)
downloadydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/python/prompt-toolkit/py3/tests/test_buffer.py')
-rw-r--r--contrib/python/prompt-toolkit/py3/tests/test_buffer.py220
1 files changed, 110 insertions, 110 deletions
diff --git a/contrib/python/prompt-toolkit/py3/tests/test_buffer.py b/contrib/python/prompt-toolkit/py3/tests/test_buffer.py
index c6c5776dc0..413ec98743 100644
--- a/contrib/python/prompt-toolkit/py3/tests/test_buffer.py
+++ b/contrib/python/prompt-toolkit/py3/tests/test_buffer.py
@@ -1,110 +1,110 @@
-import pytest
-
-from prompt_toolkit.buffer import Buffer
-
-
-@pytest.fixture
-def _buffer():
- buff = Buffer()
- return buff
-
-
-def test_initial(_buffer):
- assert _buffer.text == ""
- assert _buffer.cursor_position == 0
-
-
-def test_insert_text(_buffer):
- _buffer.insert_text("some_text")
- assert _buffer.text == "some_text"
- assert _buffer.cursor_position == len("some_text")
-
-
-def test_cursor_movement(_buffer):
- _buffer.insert_text("some_text")
- _buffer.cursor_left()
- _buffer.cursor_left()
- _buffer.cursor_left()
- _buffer.cursor_right()
- _buffer.insert_text("A")
-
- assert _buffer.text == "some_teAxt"
- assert _buffer.cursor_position == len("some_teA")
-
-
-def test_backspace(_buffer):
- _buffer.insert_text("some_text")
- _buffer.cursor_left()
- _buffer.cursor_left()
- _buffer.delete_before_cursor()
-
- assert _buffer.text == "some_txt"
- assert _buffer.cursor_position == len("some_t")
-
-
-def test_cursor_up(_buffer):
- # Cursor up to a line thats longer.
- _buffer.insert_text("long line1\nline2")
- _buffer.cursor_up()
-
- assert _buffer.document.cursor_position == 5
-
- # Going up when already at the top.
- _buffer.cursor_up()
- assert _buffer.document.cursor_position == 5
-
- # Going up to a line that's shorter.
- _buffer.reset()
- _buffer.insert_text("line1\nlong line2")
-
- _buffer.cursor_up()
- assert _buffer.document.cursor_position == 5
-
-
-def test_cursor_down(_buffer):
- _buffer.insert_text("line1\nline2")
- _buffer.cursor_position = 3
-
- # Normally going down
- _buffer.cursor_down()
- assert _buffer.document.cursor_position == len("line1\nlin")
-
- # Going down to a line that's shorter.
- _buffer.reset()
- _buffer.insert_text("long line1\na\nb")
- _buffer.cursor_position = 3
-
- _buffer.cursor_down()
- assert _buffer.document.cursor_position == len("long line1\na")
-
-
-def test_join_next_line(_buffer):
- _buffer.insert_text("line1\nline2\nline3")
- _buffer.cursor_up()
- _buffer.join_next_line()
-
- assert _buffer.text == "line1\nline2 line3"
-
- # Test when there is no '\n' in the text
- _buffer.reset()
- _buffer.insert_text("line1")
- _buffer.cursor_position = 0
- _buffer.join_next_line()
-
- assert _buffer.text == "line1"
-
-
-def test_newline(_buffer):
- _buffer.insert_text("hello world")
- _buffer.newline()
-
- assert _buffer.text == "hello world\n"
-
-
-def test_swap_characters_before_cursor(_buffer):
- _buffer.insert_text("hello world")
- _buffer.cursor_left()
- _buffer.cursor_left()
- _buffer.swap_characters_before_cursor()
-
- assert _buffer.text == "hello wrold"
+import pytest
+
+from prompt_toolkit.buffer import Buffer
+
+
+@pytest.fixture
+def _buffer():
+ buff = Buffer()
+ return buff
+
+
+def test_initial(_buffer):
+ assert _buffer.text == ""
+ assert _buffer.cursor_position == 0
+
+
+def test_insert_text(_buffer):
+ _buffer.insert_text("some_text")
+ assert _buffer.text == "some_text"
+ assert _buffer.cursor_position == len("some_text")
+
+
+def test_cursor_movement(_buffer):
+ _buffer.insert_text("some_text")
+ _buffer.cursor_left()
+ _buffer.cursor_left()
+ _buffer.cursor_left()
+ _buffer.cursor_right()
+ _buffer.insert_text("A")
+
+ assert _buffer.text == "some_teAxt"
+ assert _buffer.cursor_position == len("some_teA")
+
+
+def test_backspace(_buffer):
+ _buffer.insert_text("some_text")
+ _buffer.cursor_left()
+ _buffer.cursor_left()
+ _buffer.delete_before_cursor()
+
+ assert _buffer.text == "some_txt"
+ assert _buffer.cursor_position == len("some_t")
+
+
+def test_cursor_up(_buffer):
+ # Cursor up to a line thats longer.
+ _buffer.insert_text("long line1\nline2")
+ _buffer.cursor_up()
+
+ assert _buffer.document.cursor_position == 5
+
+ # Going up when already at the top.
+ _buffer.cursor_up()
+ assert _buffer.document.cursor_position == 5
+
+ # Going up to a line that's shorter.
+ _buffer.reset()
+ _buffer.insert_text("line1\nlong line2")
+
+ _buffer.cursor_up()
+ assert _buffer.document.cursor_position == 5
+
+
+def test_cursor_down(_buffer):
+ _buffer.insert_text("line1\nline2")
+ _buffer.cursor_position = 3
+
+ # Normally going down
+ _buffer.cursor_down()
+ assert _buffer.document.cursor_position == len("line1\nlin")
+
+ # Going down to a line that's shorter.
+ _buffer.reset()
+ _buffer.insert_text("long line1\na\nb")
+ _buffer.cursor_position = 3
+
+ _buffer.cursor_down()
+ assert _buffer.document.cursor_position == len("long line1\na")
+
+
+def test_join_next_line(_buffer):
+ _buffer.insert_text("line1\nline2\nline3")
+ _buffer.cursor_up()
+ _buffer.join_next_line()
+
+ assert _buffer.text == "line1\nline2 line3"
+
+ # Test when there is no '\n' in the text
+ _buffer.reset()
+ _buffer.insert_text("line1")
+ _buffer.cursor_position = 0
+ _buffer.join_next_line()
+
+ assert _buffer.text == "line1"
+
+
+def test_newline(_buffer):
+ _buffer.insert_text("hello world")
+ _buffer.newline()
+
+ assert _buffer.text == "hello world\n"
+
+
+def test_swap_characters_before_cursor(_buffer):
+ _buffer.insert_text("hello world")
+ _buffer.cursor_left()
+ _buffer.cursor_left()
+ _buffer.swap_characters_before_cursor()
+
+ assert _buffer.text == "hello wrold"