Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
3ff55a81
Kaydet (Commit)
3ff55a81
authored
Agu 11, 2016
tarafından
Terry Jan Reedy
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #27732: Silence test_idle with dummy bell functions.
üst
40f70d1c
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
32 additions
and
23 deletions
+32
-23
autoexpand.py
Lib/idlelib/autoexpand.py
+4
-2
test_autoexpand.py
Lib/idlelib/idle_test/test_autoexpand.py
+2
-0
test_parenmatch.py
Lib/idlelib/idle_test/test_parenmatch.py
+9
-4
test_replace.py
Lib/idlelib/idle_test/test_replace.py
+3
-3
test_search.py
Lib/idlelib/idle_test/test_search.py
+2
-0
test_undo.py
Lib/idlelib/idle_test/test_undo.py
+1
-1
parenmatch.py
Lib/idlelib/parenmatch.py
+3
-6
replace.py
Lib/idlelib/replace.py
+4
-4
search.py
Lib/idlelib/search.py
+2
-2
searchbase.py
Lib/idlelib/searchbase.py
+2
-1
No files found.
Lib/idlelib/autoexpand.py
Dosyayı görüntüle @
3ff55a81
...
@@ -31,6 +31,7 @@ class AutoExpand:
...
@@ -31,6 +31,7 @@ class AutoExpand:
def
__init__
(
self
,
editwin
):
def
__init__
(
self
,
editwin
):
self
.
text
=
editwin
.
text
self
.
text
=
editwin
.
text
self
.
bell
=
self
.
text
.
bell
self
.
state
=
None
self
.
state
=
None
def
expand_word_event
(
self
,
event
):
def
expand_word_event
(
self
,
event
):
...
@@ -46,14 +47,14 @@ class AutoExpand:
...
@@ -46,14 +47,14 @@ class AutoExpand:
words
=
self
.
getwords
()
words
=
self
.
getwords
()
index
=
0
index
=
0
if
not
words
:
if
not
words
:
self
.
text
.
bell
()
self
.
bell
()
return
"break"
return
"break"
word
=
self
.
getprevword
()
word
=
self
.
getprevword
()
self
.
text
.
delete
(
"insert -
%
d chars"
%
len
(
word
),
"insert"
)
self
.
text
.
delete
(
"insert -
%
d chars"
%
len
(
word
),
"insert"
)
newword
=
words
[
index
]
newword
=
words
[
index
]
index
=
(
index
+
1
)
%
len
(
words
)
index
=
(
index
+
1
)
%
len
(
words
)
if
index
==
0
:
if
index
==
0
:
self
.
text
.
bell
()
# Warn we cycled around
self
.
bell
()
# Warn we cycled around
self
.
text
.
insert
(
"insert"
,
newword
)
self
.
text
.
insert
(
"insert"
,
newword
)
curinsert
=
self
.
text
.
index
(
"insert"
)
curinsert
=
self
.
text
.
index
(
"insert"
)
curline
=
self
.
text
.
get
(
"insert linestart"
,
"insert lineend"
)
curline
=
self
.
text
.
get
(
"insert linestart"
,
"insert lineend"
)
...
@@ -99,6 +100,7 @@ class AutoExpand:
...
@@ -99,6 +100,7 @@ class AutoExpand:
i
=
i
-
1
i
=
i
-
1
return
line
[
i
:]
return
line
[
i
:]
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
import
unittest
import
unittest
unittest
.
main
(
'idlelib.idle_test.test_autoexpand'
,
verbosity
=
2
)
unittest
.
main
(
'idlelib.idle_test.test_autoexpand'
,
verbosity
=
2
)
Lib/idlelib/idle_test/test_autoexpand.py
Dosyayı görüntüle @
3ff55a81
...
@@ -22,6 +22,7 @@ class AutoExpandTest(unittest.TestCase):
...
@@ -22,6 +22,7 @@ class AutoExpandTest(unittest.TestCase):
else
:
else
:
cls
.
text
=
Text
()
cls
.
text
=
Text
()
cls
.
auto_expand
=
AutoExpand
(
Dummy_Editwin
(
cls
.
text
))
cls
.
auto_expand
=
AutoExpand
(
Dummy_Editwin
(
cls
.
text
))
cls
.
auto_expand
.
bell
=
lambda
:
None
@classmethod
@classmethod
def
tearDownClass
(
cls
):
def
tearDownClass
(
cls
):
...
@@ -137,5 +138,6 @@ class AutoExpandTest(unittest.TestCase):
...
@@ -137,5 +138,6 @@ class AutoExpandTest(unittest.TestCase):
new_state
=
self
.
auto_expand
.
state
new_state
=
self
.
auto_expand
.
state
self
.
assertNotEqual
(
initial_state
,
new_state
)
self
.
assertNotEqual
(
initial_state
,
new_state
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
(
verbosity
=
2
)
unittest
.
main
(
verbosity
=
2
)
Lib/idlelib/idle_test/test_parenmatch.py
Dosyayı görüntüle @
3ff55a81
...
@@ -38,12 +38,17 @@ class ParenMatchTest(unittest.TestCase):
...
@@ -38,12 +38,17 @@ class ParenMatchTest(unittest.TestCase):
def
tearDown
(
self
):
def
tearDown
(
self
):
self
.
text
.
delete
(
'1.0'
,
'end'
)
self
.
text
.
delete
(
'1.0'
,
'end'
)
def
get_parenmatch
(
self
):
pm
=
ParenMatch
(
self
.
editwin
)
pm
.
bell
=
lambda
:
None
return
pm
def
test_paren_expression
(
self
):
def
test_paren_expression
(
self
):
"""
"""
Test ParenMatch with 'expression' style.
Test ParenMatch with 'expression' style.
"""
"""
text
=
self
.
text
text
=
self
.
text
pm
=
ParenMatch
(
self
.
editwin
)
pm
=
self
.
get_parenmatch
(
)
pm
.
set_style
(
'expression'
)
pm
.
set_style
(
'expression'
)
text
.
insert
(
'insert'
,
'def foobar(a, b'
)
text
.
insert
(
'insert'
,
'def foobar(a, b'
)
...
@@ -66,7 +71,7 @@ class ParenMatchTest(unittest.TestCase):
...
@@ -66,7 +71,7 @@ class ParenMatchTest(unittest.TestCase):
Test ParenMatch with 'default' style.
Test ParenMatch with 'default' style.
"""
"""
text
=
self
.
text
text
=
self
.
text
pm
=
ParenMatch
(
self
.
editwin
)
pm
=
self
.
get_parenmatch
(
)
pm
.
set_style
(
'default'
)
pm
.
set_style
(
'default'
)
text
.
insert
(
'insert'
,
'def foobar(a, b'
)
text
.
insert
(
'insert'
,
'def foobar(a, b'
)
...
@@ -86,7 +91,7 @@ class ParenMatchTest(unittest.TestCase):
...
@@ -86,7 +91,7 @@ class ParenMatchTest(unittest.TestCase):
These cases force conditional expression and alternate paths.
These cases force conditional expression and alternate paths.
"""
"""
text
=
self
.
text
text
=
self
.
text
pm
=
ParenMatch
(
self
.
editwin
)
pm
=
self
.
get_parenmatch
(
)
text
.
insert
(
'insert'
,
'# this is a commen)'
)
text
.
insert
(
'insert'
,
'# this is a commen)'
)
self
.
assertIsNone
(
pm
.
paren_closed_event
(
'event'
))
self
.
assertIsNone
(
pm
.
paren_closed_event
(
'event'
))
...
@@ -99,7 +104,7 @@ class ParenMatchTest(unittest.TestCase):
...
@@ -99,7 +104,7 @@ class ParenMatchTest(unittest.TestCase):
self
.
assertIsNone
(
pm
.
paren_closed_event
(
'event'
))
self
.
assertIsNone
(
pm
.
paren_closed_event
(
'event'
))
def
test_handle_restore_timer
(
self
):
def
test_handle_restore_timer
(
self
):
pm
=
ParenMatch
(
self
.
editwin
)
pm
=
self
.
get_parenmatch
(
)
pm
.
restore_event
=
Mock
()
pm
.
restore_event
=
Mock
()
pm
.
handle_restore_timer
(
0
)
pm
.
handle_restore_timer
(
0
)
self
.
assertTrue
(
pm
.
restore_event
.
called
)
self
.
assertTrue
(
pm
.
restore_event
.
called
)
...
...
Lib/idlelib/idle_test/test_replace.py
Dosyayı görüntüle @
3ff55a81
...
@@ -7,7 +7,7 @@ from unittest.mock import Mock
...
@@ -7,7 +7,7 @@ from unittest.mock import Mock
from
tkinter
import
Tk
,
Text
from
tkinter
import
Tk
,
Text
from
idlelib.idle_test.mock_tk
import
Mbox
from
idlelib.idle_test.mock_tk
import
Mbox
import
idlelib.searchengine
as
se
import
idlelib.searchengine
as
se
import
idlelib.replace
as
rd
from
idlelib.replace
import
ReplaceDialog
orig_mbox
=
se
.
tkMessageBox
orig_mbox
=
se
.
tkMessageBox
showerror
=
Mbox
.
showerror
showerror
=
Mbox
.
showerror
...
@@ -21,7 +21,8 @@ class ReplaceDialogTest(unittest.TestCase):
...
@@ -21,7 +21,8 @@ class ReplaceDialogTest(unittest.TestCase):
cls
.
root
.
withdraw
()
cls
.
root
.
withdraw
()
se
.
tkMessageBox
=
Mbox
se
.
tkMessageBox
=
Mbox
cls
.
engine
=
se
.
SearchEngine
(
cls
.
root
)
cls
.
engine
=
se
.
SearchEngine
(
cls
.
root
)
cls
.
dialog
=
rd
.
ReplaceDialog
(
cls
.
root
,
cls
.
engine
)
cls
.
dialog
=
ReplaceDialog
(
cls
.
root
,
cls
.
engine
)
cls
.
dialog
.
bell
=
lambda
:
None
cls
.
dialog
.
ok
=
Mock
()
cls
.
dialog
.
ok
=
Mock
()
cls
.
text
=
Text
(
cls
.
root
)
cls
.
text
=
Text
(
cls
.
root
)
cls
.
text
.
undo_block_start
=
Mock
()
cls
.
text
.
undo_block_start
=
Mock
()
...
@@ -70,7 +71,6 @@ class ReplaceDialogTest(unittest.TestCase):
...
@@ -70,7 +71,6 @@ class ReplaceDialogTest(unittest.TestCase):
# text found and replaced
# text found and replaced
pv
.
set
(
'a'
)
pv
.
set
(
'a'
)
rv
.
set
(
'asdf'
)
rv
.
set
(
'asdf'
)
self
.
dialog
.
open
(
self
.
text
)
replace
()
replace
()
equal
(
text
.
get
(
'1.8'
,
'1.12'
),
'asdf'
)
equal
(
text
.
get
(
'1.8'
,
'1.12'
),
'asdf'
)
...
...
Lib/idlelib/idle_test/test_search.py
Dosyayı görüntüle @
3ff55a81
...
@@ -29,6 +29,7 @@ class SearchDialogTest(unittest.TestCase):
...
@@ -29,6 +29,7 @@ class SearchDialogTest(unittest.TestCase):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
engine
=
se
.
SearchEngine
(
self
.
root
)
self
.
engine
=
se
.
SearchEngine
(
self
.
root
)
self
.
dialog
=
sd
.
SearchDialog
(
self
.
root
,
self
.
engine
)
self
.
dialog
=
sd
.
SearchDialog
(
self
.
root
,
self
.
engine
)
self
.
dialog
.
bell
=
lambda
:
None
self
.
text
=
tk
.
Text
(
self
.
root
)
self
.
text
=
tk
.
Text
(
self
.
root
)
self
.
text
.
insert
(
'1.0'
,
'Hello World!'
)
self
.
text
.
insert
(
'1.0'
,
'Hello World!'
)
...
@@ -38,6 +39,7 @@ class SearchDialogTest(unittest.TestCase):
...
@@ -38,6 +39,7 @@ class SearchDialogTest(unittest.TestCase):
self
.
engine
.
setpat
(
''
)
self
.
engine
.
setpat
(
''
)
self
.
assertFalse
(
self
.
dialog
.
find_again
(
text
))
self
.
assertFalse
(
self
.
dialog
.
find_again
(
text
))
self
.
dialog
.
bell
=
lambda
:
None
self
.
engine
.
setpat
(
'Hello'
)
self
.
engine
.
setpat
(
'Hello'
)
self
.
assertTrue
(
self
.
dialog
.
find_again
(
text
))
self
.
assertTrue
(
self
.
dialog
.
find_again
(
text
))
...
...
Lib/idlelib/idle_test/test_undo.py
Dosyayı görüntüle @
3ff55a81
...
@@ -29,8 +29,8 @@ class UndoDelegatorTest(unittest.TestCase):
...
@@ -29,8 +29,8 @@ class UndoDelegatorTest(unittest.TestCase):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
delegator
=
UndoDelegator
()
self
.
delegator
=
UndoDelegator
()
self
.
delegator
.
bell
=
Mock
()
self
.
percolator
.
insertfilter
(
self
.
delegator
)
self
.
percolator
.
insertfilter
(
self
.
delegator
)
self
.
delegator
.
bell
=
Mock
(
wraps
=
self
.
delegator
.
bell
)
def
tearDown
(
self
):
def
tearDown
(
self
):
self
.
percolator
.
removefilter
(
self
.
delegator
)
self
.
percolator
.
removefilter
(
self
.
delegator
)
...
...
Lib/idlelib/parenmatch.py
Dosyayı görüntüle @
3ff55a81
...
@@ -64,6 +64,7 @@ class ParenMatch:
...
@@ -64,6 +64,7 @@ class ParenMatch:
# and deactivate_restore (which calls event_delete).
# and deactivate_restore (which calls event_delete).
editwin
.
text
.
bind
(
self
.
RESTORE_VIRTUAL_EVENT_NAME
,
editwin
.
text
.
bind
(
self
.
RESTORE_VIRTUAL_EVENT_NAME
,
self
.
restore_event
)
self
.
restore_event
)
self
.
bell
=
self
.
text
.
bell
if
self
.
BELL
else
lambda
:
None
self
.
counter
=
0
self
.
counter
=
0
self
.
is_restore_active
=
0
self
.
is_restore_active
=
0
self
.
set_style
(
self
.
STYLE
)
self
.
set_style
(
self
.
STYLE
)
...
@@ -93,7 +94,7 @@ class ParenMatch:
...
@@ -93,7 +94,7 @@ class ParenMatch:
indices
=
(
HyperParser
(
self
.
editwin
,
"insert"
)
indices
=
(
HyperParser
(
self
.
editwin
,
"insert"
)
.
get_surrounding_brackets
())
.
get_surrounding_brackets
())
if
indices
is
None
:
if
indices
is
None
:
self
.
warn_mismatched
()
self
.
bell
()
return
return
self
.
activate_restore
()
self
.
activate_restore
()
self
.
create_tag
(
indices
)
self
.
create_tag
(
indices
)
...
@@ -109,7 +110,7 @@ class ParenMatch:
...
@@ -109,7 +110,7 @@ class ParenMatch:
return
return
indices
=
hp
.
get_surrounding_brackets
(
_openers
[
closer
],
True
)
indices
=
hp
.
get_surrounding_brackets
(
_openers
[
closer
],
True
)
if
indices
is
None
:
if
indices
is
None
:
self
.
warn_mismatched
()
self
.
bell
()
return
return
self
.
activate_restore
()
self
.
activate_restore
()
self
.
create_tag
(
indices
)
self
.
create_tag
(
indices
)
...
@@ -124,10 +125,6 @@ class ParenMatch:
...
@@ -124,10 +125,6 @@ class ParenMatch:
if
timer_count
==
self
.
counter
:
if
timer_count
==
self
.
counter
:
self
.
restore_event
()
self
.
restore_event
()
def
warn_mismatched
(
self
):
if
self
.
BELL
:
self
.
text
.
bell
()
# any one of the create_tag_XXX methods can be used depending on
# any one of the create_tag_XXX methods can be used depending on
# the style
# the style
...
...
Lib/idlelib/replace.py
Dosyayı görüntüle @
3ff55a81
...
@@ -95,7 +95,7 @@ class ReplaceDialog(SearchDialogBase):
...
@@ -95,7 +95,7 @@ class ReplaceDialog(SearchDialogBase):
text
=
self
.
text
text
=
self
.
text
res
=
self
.
engine
.
search_text
(
text
,
prog
)
res
=
self
.
engine
.
search_text
(
text
,
prog
)
if
not
res
:
if
not
res
:
text
.
bell
()
self
.
bell
()
return
return
text
.
tag_remove
(
"sel"
,
"1.0"
,
"end"
)
text
.
tag_remove
(
"sel"
,
"1.0"
,
"end"
)
text
.
tag_remove
(
"hit"
,
"1.0"
,
"end"
)
text
.
tag_remove
(
"hit"
,
"1.0"
,
"end"
)
...
@@ -142,7 +142,7 @@ class ReplaceDialog(SearchDialogBase):
...
@@ -142,7 +142,7 @@ class ReplaceDialog(SearchDialogBase):
text
=
self
.
text
text
=
self
.
text
res
=
self
.
engine
.
search_text
(
text
,
None
,
ok
)
res
=
self
.
engine
.
search_text
(
text
,
None
,
ok
)
if
not
res
:
if
not
res
:
text
.
bell
()
self
.
bell
()
return
False
return
False
line
,
m
=
res
line
,
m
=
res
i
,
j
=
m
.
span
()
i
,
j
=
m
.
span
()
...
@@ -204,8 +204,8 @@ class ReplaceDialog(SearchDialogBase):
...
@@ -204,8 +204,8 @@ class ReplaceDialog(SearchDialogBase):
def
_replace_dialog
(
parent
):
# htest #
def
_replace_dialog
(
parent
):
# htest #
from
tkinter
import
Toplevel
,
Text
from
tkinter
import
Toplevel
,
Text
,
END
,
SEL
from
tkiter.ttk
import
Button
from
tki
n
ter.ttk
import
Button
box
=
Toplevel
(
parent
)
box
=
Toplevel
(
parent
)
box
.
title
(
"Test ReplaceDialog"
)
box
.
title
(
"Test ReplaceDialog"
)
...
...
Lib/idlelib/search.py
Dosyayı görüntüle @
3ff55a81
...
@@ -51,7 +51,7 @@ class SearchDialog(SearchDialogBase):
...
@@ -51,7 +51,7 @@ class SearchDialog(SearchDialogBase):
selfirst
=
text
.
index
(
"sel.first"
)
selfirst
=
text
.
index
(
"sel.first"
)
sellast
=
text
.
index
(
"sel.last"
)
sellast
=
text
.
index
(
"sel.last"
)
if
selfirst
==
first
and
sellast
==
last
:
if
selfirst
==
first
and
sellast
==
last
:
text
.
bell
()
self
.
bell
()
return
False
return
False
except
TclError
:
except
TclError
:
pass
pass
...
@@ -61,7 +61,7 @@ class SearchDialog(SearchDialogBase):
...
@@ -61,7 +61,7 @@ class SearchDialog(SearchDialogBase):
text
.
see
(
"insert"
)
text
.
see
(
"insert"
)
return
True
return
True
else
:
else
:
text
.
bell
()
self
.
bell
()
return
False
return
False
def
find_selection
(
self
,
text
):
def
find_selection
(
self
,
text
):
...
...
Lib/idlelib/searchbase.py
Dosyayı görüntüle @
3ff55a81
...
@@ -79,6 +79,7 @@ class SearchDialogBase:
...
@@ -79,6 +79,7 @@ class SearchDialogBase:
top
.
wm_title
(
self
.
title
)
top
.
wm_title
(
self
.
title
)
top
.
wm_iconname
(
self
.
icon
)
top
.
wm_iconname
(
self
.
icon
)
self
.
top
=
top
self
.
top
=
top
self
.
bell
=
top
.
bell
self
.
row
=
0
self
.
row
=
0
self
.
top
.
grid_columnconfigure
(
0
,
pad
=
2
,
weight
=
0
)
self
.
top
.
grid_columnconfigure
(
0
,
pad
=
2
,
weight
=
0
)
...
@@ -188,7 +189,7 @@ class _searchbase(SearchDialogBase): # htest #
...
@@ -188,7 +189,7 @@ class _searchbase(SearchDialogBase): # htest #
width
,
height
,
x
,
y
=
list
(
map
(
int
,
re
.
split
(
'[x+]'
,
parent
.
geometry
())))
width
,
height
,
x
,
y
=
list
(
map
(
int
,
re
.
split
(
'[x+]'
,
parent
.
geometry
())))
self
.
top
.
geometry
(
"+
%
d+
%
d"
%
(
x
+
40
,
y
+
175
))
self
.
top
.
geometry
(
"+
%
d+
%
d"
%
(
x
+
40
,
y
+
175
))
def
default_command
(
self
):
pass
def
default_command
(
self
,
dummy
):
pass
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
import
unittest
import
unittest
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment