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
cc4290bf
Commit
cc4290bf
authored
Dec 25, 2013
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #19320: test_tcl no longer fails when wantobjects is false.
parent
848972ca
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
13 deletions
+31
-13
Lib/test/test_tcl.py
Lib/test/test_tcl.py
+29
-13
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/test/test_tcl.py
View file @
cc4290bf
...
...
@@ -35,6 +35,7 @@ class TclTest(unittest.TestCase):
def
setUp
(
self
):
self
.
interp
=
Tcl
()
self
.
wantobjects
=
self
.
interp
.
tk
.
wantobjects
()
def
testEval
(
self
):
tcl
=
self
.
interp
...
...
@@ -167,22 +168,31 @@ class TclTest(unittest.TestCase):
def
passValue
(
value
):
return
self
.
interp
.
call
(
'set'
,
'_'
,
value
)
self
.
assertEqual
(
passValue
(
True
),
True
)
self
.
assertEqual
(
passValue
(
False
),
False
)
self
.
assertEqual
(
passValue
(
True
),
True
if
self
.
wantobjects
else
'1'
)
self
.
assertEqual
(
passValue
(
False
),
False
if
self
.
wantobjects
else
'0'
)
self
.
assertEqual
(
passValue
(
'string'
),
'string'
)
self
.
assertEqual
(
passValue
(
'string
\
u20ac
'
),
'string
\
u20ac
'
)
for
i
in
(
0
,
1
,
-
1
,
2
**
31
-
1
,
-
2
**
31
):
self
.
assertEqual
(
passValue
(
i
),
i
)
self
.
assertEqual
(
passValue
(
i
),
i
if
self
.
wantobjects
else
str
(
i
)
)
for
f
in
(
0.0
,
1.0
,
-
1.0
,
1
/
3
,
sys
.
float_info
.
min
,
sys
.
float_info
.
max
,
-
sys
.
float_info
.
min
,
-
sys
.
float_info
.
max
):
self
.
assertEqual
(
passValue
(
f
),
f
)
for
f
in
float
(
'nan'
),
float
(
'inf'
),
-
float
(
'inf'
):
if
f
!=
f
:
# NaN
self
.
assertNotEqual
(
passValue
(
f
),
f
)
else
:
if
self
.
wantobjects
:
self
.
assertEqual
(
passValue
(
f
),
f
)
self
.
assertEqual
(
passValue
((
1
,
'2'
,
(
3.4
,))),
(
1
,
'2'
,
(
3.4
,)))
else
:
self
.
assertEqual
(
float
(
passValue
(
f
)),
f
)
if
self
.
wantobjects
:
f
=
passValue
(
float
(
'nan'
))
self
.
assertNotEqual
(
f
,
f
)
self
.
assertEqual
(
passValue
(
float
(
'inf'
)),
float
(
'inf'
))
self
.
assertEqual
(
passValue
(
-
float
(
'inf'
)),
-
float
(
'inf'
))
else
:
f
=
float
(
passValue
(
float
(
'nan'
)))
self
.
assertNotEqual
(
f
,
f
)
self
.
assertEqual
(
float
(
passValue
(
float
(
'inf'
))),
float
(
'inf'
))
self
.
assertEqual
(
float
(
passValue
(
-
float
(
'inf'
))),
-
float
(
'inf'
))
self
.
assertEqual
(
passValue
((
1
,
'2'
,
(
3.4
,))),
(
1
,
'2'
,
(
3.4
,))
if
self
.
wantobjects
else
'1 2 3.4'
)
def
test_splitlist
(
self
):
splitlist
=
self
.
interp
.
tk
.
splitlist
...
...
@@ -207,12 +217,15 @@ class TclTest(unittest.TestCase):
('
a
3.4
', ('
a
', '
3.4
')),
(('
a
', 3.4), ('
a
', 3.4)),
((), ()),
(call('
list
', 1, '
2
', (3.4,)), (1, '
2
', (3.4,))),
(call('
list
', 1, '
2
', (3.4,)),
(1, '
2
', (3.4,)) if self.wantobjects else
('
1
', '
2
', '
3.4
')),
]
if tcl_version >= (8, 5):
testcases += [
(call('
dict
', '
create
', 1, '
\
u20ac
', b'
\
xe2
\
x82
\
xac
', (3.4,)),
(1, '
\
u20ac
', '
\
u20ac
', (3.4,))),
(1, '
\
u20ac
', '
\
u20ac
', (3.4,)) if self.wantobjects else
('
1
', '
\
u20ac
', '
\
u20ac
', '
3.4
')),
]
for arg, res in testcases:
self.assertEqual(splitlist(arg), res, msg=arg)
...
...
@@ -244,12 +257,15 @@ class TclTest(unittest.TestCase):
(('
a
', 3.4), ('
a
', 3.4)),
(('
a
', (2, 3.4)), ('
a
', (2, 3.4))),
((), ()),
(call('
list
', 1, '
2
', (3.4,)), (1, '
2
', (3.4,))),
(call('
list
', 1, '
2
', (3.4,)),
(1, '
2
', (3.4,)) if self.wantobjects else
('
1
', '
2
', '
3.4
')),
]
if tcl_version >= (8, 5):
testcases += [
(call('
dict
', '
create
', 12, '
\
u20ac
', b'
\
xe2
\
x82
\
xac
', (3.4,)),
(12, '
\
u20ac
', '
\
u20ac
', (3.4,))),
(12, '
\
u20ac
', '
\
u20ac
', (3.4,)) if self.wantobjects else
('
12
', '
\
u20ac
', '
\
u20ac
', '
3.4
')),
]
for arg, res in testcases:
self.assertEqual(split(arg), res, msg=arg)
...
...
Misc/NEWS
View file @
cc4290bf
...
...
@@ -182,6 +182,8 @@ IDLE
Tests
-----
- Issue #19320: test_tcl no longer fails when wantobjects is false.
- Issue #19683: Removed empty tests from test_minidom. Patch by Ajitesh Gupta.
- Issue #19919: Fix flacky SSL test. connect_ex() sometimes returns
...
...
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