Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-119205: Fix autocompletion bug in new repl#119229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ambv merged 15 commits intopython:mainfromkoxudaxi:fix-issue-119205
May 21, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
15 commits
Select commitHold shift + click to select a range
8a0241f
gh-119205: Fix autocompletion bug in new repl
koxudaxiMay 20, 2024
05c271b
Merge branch 'main' into fix-issue-119205
koxudaxiMay 20, 2024
852cd53
📜🤖 Added by blurb_it.
blurb-it[bot]May 20, 2024
f9ee809
gh-119205: Add unittest
koxudaxiMay 20, 2024
22cdb57
Merge branch 'main' into fix-issue-119205
koxudaxiMay 20, 2024
241e634
gh-119205: revert unnecessary changes
koxudaxiMay 20, 2024
e5f1575
gh-119205: revert unnecessary changes
koxudaxiMay 20, 2024
b2f1b02
gh-119205: Improve unittest
koxudaxiMay 20, 2024
6509c29
gh-119205: Improve suppression warning
koxudaxiMay 20, 2024
3d41951
Merge branch 'main' into fix-issue-119205
koxudaxiMay 21, 2024
e8988b8
Merge branch 'main' into fix-issue-119205
ambvMay 21, 2024
fe484c7
Remove news
ambvMay 21, 2024
a1e81f5
Merge branch 'main' into fix-issue-119205
koxudaxiMay 21, 2024
159f9d8
Merge branch 'main' into fix-issue-119205
koxudaxiMay 21, 2024
11c3a18
Merge branch 'main' into fix-issue-119205
koxudaxiMay 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletionLib/_pyrepl/readline.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,6 +28,7 @@

from __future__ import annotations

import warnings
from dataclasses import dataclass, field

import os
Expand DownExpand Up@@ -301,7 +302,8 @@ def multiline_input(self, more_lines: MoreLinesCallable, ps1: str, ps2: str) ->
reader.more_lines = more_lines
reader.ps1 = reader.ps2 = ps1
reader.ps3 = reader.ps4 = ps2
return reader.readline(), reader.was_paste_mode_activated
with warnings.catch_warnings(action="ignore"):
return reader.readline(), reader.was_paste_mode_activated
finally:
reader.more_lines = saved
reader.paste_mode = False
Expand Down
30 changes: 24 additions & 6 deletionsLib/test/test_pyrepl/test_pyrepl.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
import itertools
import io
import os
import rlcompleter
import unittest
from unittest import TestCase
from unittest.mock import patch

from .support import FakeConsole, handle_all_events, handle_events_narrow_console, multiline_input, code_to_events
from .support import FakeConsole, handle_all_events, handle_events_narrow_console
from .support import more_lines, multiline_input, code_to_events
from _pyrepl.console import Event
from _pyrepl.readline import ReadlineAlikeReader, ReadlineConfig
from _pyrepl.readline import multiline_input as readline_multiline_input


class TestCursorPosition(TestCase):
Expand DownExpand Up@@ -475,6 +478,25 @@ def test_updown_arrow_with_completion_menu(self):
output = multiline_input(reader, namespace)
self.assertEqual(output, "os.")

@patch("_pyrepl.readline._ReadlineWrapper.get_reader")
@patch("sys.stderr", new_callable=io.StringIO)
def test_completion_with_warnings(self, mock_stderr, mock_get_reader):
class Dummy:
@property
def test_func(self):
import warnings
warnings.warn("warnings\n")
return None

dummy = Dummy()
events = code_to_events("dummy.test_func.\t\n\n")
namespace = {"dummy": dummy}
reader = self.prepare_reader(events, namespace)
mock_get_reader.return_value = reader
output = readline_multiline_input(more_lines, ">>>", "...")
self.assertEqual(output[0], "dummy.test_func.__")
self.assertEqual(mock_stderr.getvalue(), "")


class TestPasteEvent(TestCase):
def prepare_reader(self, events):
Expand DownExpand Up@@ -633,7 +655,3 @@ def test_bracketed_paste_single_line(self):
reader = self.prepare_reader(events)
output = multiline_input(reader)
self.assertEqual(output, input_code)


if __name__ == "__main__":
unittest.main()
2 changes: 1 addition & 1 deletionLib/test/test_pyrepl/test_unix_eventqueue.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,7 @@


@patch("_pyrepl.curses.tigetstr", lambda x: b"")
classTestUnivEventQueue(unittest.TestCase):
classTestUnixEventQueue(unittest.TestCase):
def setUp(self):
self.file = tempfile.TemporaryFile()

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp