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
b48a49e4
Commit
b48a49e4
authored
Aug 03, 2010
by
Ezio Melotti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix deprecation warnings in test_scope.py
parent
8a609267
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
11 deletions
+14
-11
Lib/test/test_scope.py
Lib/test/test_scope.py
+14
-11
No files found.
Lib/test/test_scope.py
View file @
b48a49e4
import
unittest
from
test.test_support
import
check_syntax_error
,
run_unittest
from
test.test_support
import
(
check_syntax_error
,
_check_py3k_warnings
,
check_warnings
,
run_unittest
)
import
warnings
warnings
.
filterwarnings
(
"ignore"
,
r"import \
*
", SyntaxWarning, "
<
test
string
>
")
warnings.filterwarnings("
ignore
", r"
import
\
*
", SyntaxWarning, "
<
string
>
")
class
ScopeTests
(
unittest
.
TestCase
):
...
...
@@ -332,11 +330,14 @@ else:
self
.
assertEqual
(
makeReturner2
(
a
=
11
)()[
'a'
],
11
)
def makeAddPair((a, b)):
def addPair((c, d)):
return (a + c, b + d)
return addPair
with
_check_py3k_warnings
((
"tuple parameter unpacking has been removed"
,
SyntaxWarning
)):
exec
"""
\
def makeAddPair((a, b)):
def addPair((c, d)):
return (a + c, b + d)
return addPair
"""
in
locals
()
self
.
assertEqual
(
makeAddPair
((
1
,
2
))((
100
,
200
)),
(
101
,
202
))
def
testScopeOfGlobalStmt
(
self
):
...
...
@@ -482,7 +483,7 @@ self.assert_(X.passed)
return
g
d
=
f
(
2
)(
4
)
self.assert
_(d.has_key('h')
)
self
.
assert
True
(
'h'
in
d
)
del
d
[
'h'
]
self
.
assertEqual
(
d
,
{
'x'
:
2
,
'y'
:
7
,
'w'
:
6
})
...
...
@@ -659,7 +660,9 @@ result2 = h()
def
test_main
():
run_unittest(ScopeTests)
with
check_warnings
((
"import
\
* o
n
ly allowed at module level"
,
SyntaxWarning
)):
run_unittest
(
ScopeTests
)
if
__name__
==
'__main__'
:
test_main
()
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