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
6712a3e1
Commit
6712a3e1
authored
Mar 24, 2011
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove test_importable(). Couldn't see how to make this reliable across all platforms.
parent
d4652fab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
25 deletions
+0
-25
Lib/test/test_collections.py
Lib/test/test_collections.py
+0
-25
No files found.
Lib/test/test_collections.py
View file @
6712a3e1
...
...
@@ -332,37 +332,12 @@ class TestNamedTuple(unittest.TestCase):
# verify that _source can be run through exec()
tmp
=
namedtuple
(
'NTColor'
,
'red green blue'
)
globals
().
pop
(
'NTColor'
,
None
)
# remove artifacts from other tests
self
.
assertNotIn
(
'NTColor'
,
globals
())
exec
(
tmp
.
_source
,
globals
())
self
.
assertIn
(
'NTColor'
,
globals
())
c
=
NTColor
(
10
,
20
,
30
)
self
.
assertEqual
((
c
.
red
,
c
.
green
,
c
.
blue
),
(
10
,
20
,
30
))
self
.
assertEqual
(
NTColor
.
_fields
,
(
'red'
,
'green'
,
'blue'
))
globals
().
pop
(
'NTColor'
,
None
)
# clean-up after this test
self
.
assertNotIn
(
'NTColor'
,
globals
())
def
test_source_importable
(
self
):
tmp
=
namedtuple
(
'Color'
,
'hue sat val'
)
compiled
=
None
source
=
TESTFN
+
'.py'
with
open
(
source
,
'w'
)
as
f
:
print
(
tmp
.
_source
,
file
=
f
)
if
TESTFN
in
sys
.
modules
:
del
sys
.
modules
[
TESTFN
]
try
:
mod
=
__import__
(
TESTFN
)
compiled
=
mod
.
__file__
Color
=
mod
.
Color
c
=
Color
(
10
,
20
,
30
)
self
.
assertEqual
((
c
.
hue
,
c
.
sat
,
c
.
val
),
(
10
,
20
,
30
))
self
.
assertEqual
(
Color
.
_fields
,
(
'hue'
,
'sat'
,
'val'
))
finally
:
forget
(
TESTFN
)
if
compiled
:
unlink
(
compiled
)
unlink
(
source
)
################################################################################
...
...
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