Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
462c357d
Commit
462c357d
authored
Apr 22, 2015
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed full Tcl version parsing in tests for pre-final versions.
parent
333518e0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
27 deletions
+23
-27
Lib/test/test_tcl.py
Lib/test/test_tcl.py
+11
-15
Lib/tkinter/test/support.py
Lib/tkinter/test/support.py
+10
-10
Lib/tkinter/test/test_ttk/test_widgets.py
Lib/tkinter/test/test_ttk/test_widgets.py
+2
-2
No files found.
Lib/test/test_tcl.py
View file @
462c357d
import
unittest
import
re
import
sys
import
os
from
test
import
support
...
...
@@ -17,27 +18,22 @@ try:
except
ImportError
:
INT_MAX
=
PY_SSIZE_T_MAX
=
sys
.
maxsize
tcl_version
=
_tkinter
.
TCL_VERSION
.
split
(
'.'
)
try
:
for
i
in
range
(
len
(
tcl_version
)):
tcl_version
[
i
]
=
int
(
tcl_version
[
i
])
except
ValueError
:
pass
tcl_version
=
tuple
(
tcl_version
)
tcl_version
=
tuple
(
map
(
int
,
_tkinter
.
TCL_VERSION
.
split
(
'.'
)))
_tk_patchlevel
=
None
def
get_tk_patchlevel
():
global
_tk_patchlevel
if
_tk_patchlevel
is
None
:
tcl
=
Tcl
()
patchlevel
=
[]
for
x
in
tcl
.
call
(
'info'
,
'patchlevel'
).
split
(
'.'
):
try
:
x
=
int
(
x
,
10
)
except
ValueError
:
x
=
-
1
patchlevel
.
append
(
x
)
_tk_patchlevel
=
tuple
(
patchlevel
)
patchlevel
=
tcl
.
call
(
'info'
,
'patchlevel'
)
m
=
re
.
fullmatch
(
r'(\
d+)
\.(\
d+)([
ab.])(\
d+)
', patchlevel)
major, minor, releaselevel, serial = m.groups()
major, minor, serial = int(major), int(minor), int(serial)
releaselevel = {'
a
': '
alpha
', 'b': '
beta
', '
.
': '
final
'}[releaselevel]
if releaselevel == '
final
':
_tk_patchlevel = major, minor, serial, releaselevel, 0
else:
_tk_patchlevel = major, minor, 0, releaselevel, serial
return _tk_patchlevel
...
...
Lib/tkinter/test/support.py
View file @
462c357d
import
sys
import
re
import
tkinter
import
unittest
from
test.support
import
requires
class
AbstractTkTest
:
...
...
@@ -63,14 +62,15 @@ def get_tk_patchlevel():
global
_tk_patchlevel
if
_tk_patchlevel
is
None
:
tcl
=
tkinter
.
Tcl
()
patchlevel
=
[]
for
x
in
tcl
.
call
(
'info'
,
'patchlevel'
).
split
(
'.'
):
try
:
x
=
int
(
x
,
10
)
except
ValueError
:
x
=
-
1
patchlevel
.
append
(
x
)
_tk_patchlevel
=
tuple
(
patchlevel
)
patchlevel
=
tcl
.
call
(
'info'
,
'patchlevel'
)
m
=
re
.
fullmatch
(
r'(\
d+)
\.(\
d+)([
ab.])(\
d+)
', patchlevel)
major, minor, releaselevel, serial = m.groups()
major, minor, serial = int(major), int(minor), int(serial)
releaselevel = {'
a
': '
alpha
', 'b': '
beta
', '
.
': '
final
'}[releaselevel]
if releaselevel == '
final
':
_tk_patchlevel = major, minor, serial, releaselevel, 0
else:
_tk_patchlevel = major, minor, 0, releaselevel, serial
return _tk_patchlevel
units = {
...
...
Lib/tkinter/test/test_ttk/test_widgets.py
View file @
462c357d
...
...
@@ -20,7 +20,7 @@ class StandardTtkOptionsTests(StandardOptionsTests):
widget
=
self
.
create
()
self
.
assertEqual
(
widget
[
'class'
],
''
)
errmsg
=
'attempt to change read-only option'
if
get_tk_patchlevel
()
<
(
8
,
6
,
0
):
# actually this was changed in 8.6b3
if
get_tk_patchlevel
()
<
(
8
,
6
,
0
,
'beta'
,
3
):
errmsg
=
'Attempt to change read-only option'
self
.
checkInvalidParam
(
widget
,
'class'
,
'Foo'
,
errmsg
=
errmsg
)
widget2
=
self
.
create
(
class_
=
'Foo'
)
...
...
@@ -551,7 +551,7 @@ class PanedWindowTest(AbstractWidgetTest, unittest.TestCase):
widget = self.create()
self.assertEqual(str(widget['
orient
']), '
vertical
')
errmsg='
attempt
to
change
read
-
only
option
'
if get_tk_patchlevel() < (8, 6, 0
): # actually this was changed in 8.6b3
if get_tk_patchlevel() < (8, 6, 0
, '
beta
', 3):
errmsg='
Attempt
to
change
read
-
only
option
'
self.checkInvalidParam(widget, '
orient
', '
horizontal
',
errmsg=errmsg)
...
...
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