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
06ca3f0c
Commit
06ca3f0c
authored
Jul 21, 2018
by
Serhiy Storchaka
Committed by
GitHub
Jul 21, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-34136: Make test_do_not_recreate_annotations more reliable. (GH-8364)
parent
f2626ce6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
Lib/test/test_opcodes.py
Lib/test/test_opcodes.py
+9
-5
No files found.
Lib/test/test_opcodes.py
View file @
06ca3f0c
# Python test set -- part 2, opcodes
# Python test set -- part 2, opcodes
import
unittest
import
unittest
from
test
import
ann_module
from
test
import
ann_module
,
support
class
OpcodeTest
(
unittest
.
TestCase
):
class
OpcodeTest
(
unittest
.
TestCase
):
...
@@ -42,10 +42,14 @@ class OpcodeTest(unittest.TestCase):
...
@@ -42,10 +42,14 @@ class OpcodeTest(unittest.TestCase):
self
.
assertEqual
(
ns
[
'__annotations__'
],
{
'x'
:
int
,
1
:
2
})
self
.
assertEqual
(
ns
[
'__annotations__'
],
{
'x'
:
int
,
1
:
2
})
def
test_do_not_recreate_annotations
(
self
):
def
test_do_not_recreate_annotations
(
self
):
annotations
=
{}
# Don't rely on the existence of the '__annotations__' global.
with
support
.
swap_item
(
globals
(),
'__annotations__'
,
annotations
):
class
C
:
class
C
:
del
__annotations__
del
__annotations__
with
self
.
assertRaises
(
NameError
):
x
:
int
# Updates the '__annotations__' global.
x
:
int
self
.
assertIn
(
'x'
,
annotations
)
self
.
assertIs
(
annotations
[
'x'
],
int
)
def
test_raise_class_exceptions
(
self
):
def
test_raise_class_exceptions
(
self
):
...
...
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