From 7e8da248392e523c68c13c47fb9a46ad227f6bfb Mon Sep 17 00:00:00 2001 From: sobolevn Date: Wed, 28 Jun 2023 13:58:48 +0300 Subject: [PATCH 1/3] gh-106194: Rename duplicated tests in `test_curses` --- Lib/test/test_curses.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py index 3ab837e4f95681..52e790a8c9abad 100644 --- a/Lib/test/test_curses.py +++ b/Lib/test/test_curses.py @@ -1364,11 +1364,9 @@ def test_move_left(self): self.mock_win.reset_mock() self.textbox.do_command(curses.KEY_LEFT) self.mock_win.move.assert_called_with(1, 0) - self.textbox.do_command(curses.KEY_RIGHT) - self.mock_win.move.assert_called_with(1, 2) self.mock_win.reset_mock() - def test_move_left(self): + def test_move_right(self): """Test moving the cursor left.""" self.mock_win.reset_mock() self.textbox.do_command(curses.KEY_RIGHT) From fe33a3e25856853c17afe4703f246d93ef42fb32 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Wed, 28 Jun 2023 14:28:38 +0300 Subject: [PATCH 2/3] Address review --- Lib/test/test_curses.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py index 52e790a8c9abad..c85ebb74866936 100644 --- a/Lib/test/test_curses.py +++ b/Lib/test/test_curses.py @@ -1367,8 +1367,17 @@ def test_move_left(self): self.mock_win.reset_mock() def test_move_right(self): - """Test moving the cursor left.""" + """Test moving the cursor right.""" + self.mock_win.reset_mock() + self.textbox.do_command(curses.KEY_RIGHT) + self.mock_win.move.assert_called_with(1, 2) self.mock_win.reset_mock() + + def test_move_left_and_right(self): + """Test moving the cursor left and then right.""" + self.mock_win.reset_mock() + self.textbox.do_command(curses.KEY_LEFT) + self.mock_win.move.assert_called_with(1, 0) self.textbox.do_command(curses.KEY_RIGHT) self.mock_win.move.assert_called_with(1, 2) self.mock_win.reset_mock() From 6c296d86e975b2ca0c67dd05078dc1379348e4fa Mon Sep 17 00:00:00 2001 From: sobolevn Date: Wed, 28 Jun 2023 17:14:59 +0300 Subject: [PATCH 3/3] Address review --- Lib/test/test_curses.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py index c85ebb74866936..31bc108e7712ea 100644 --- a/Lib/test/test_curses.py +++ b/Lib/test/test_curses.py @@ -1383,14 +1383,14 @@ def test_move_left_and_right(self): self.mock_win.reset_mock() def test_move_up(self): - """Test moving the cursor left.""" + """Test moving the cursor up.""" self.mock_win.reset_mock() self.textbox.do_command(curses.KEY_UP) self.mock_win.move.assert_called_with(0, 1) self.mock_win.reset_mock() def test_move_down(self): - """Test moving the cursor left.""" + """Test moving the cursor down.""" self.mock_win.reset_mock() self.textbox.do_command(curses.KEY_DOWN) self.mock_win.move.assert_called_with(2, 1)