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
22ebb2d6
Commit
22ebb2d6
authored
Jan 02, 2013
by
Ezio Melotti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#16748: test_heapq now works with unittest test discovery.
parent
c5270372
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
27 deletions
+10
-27
Lib/test/test_heapq.py
Lib/test/test_heapq.py
+8
-27
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/test/test_heapq.py
View file @
22ebb2d6
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
sys
import
sys
import
random
import
random
import
unittest
from
test
import
support
from
test
import
support
from
unittest
import
TestCase
,
skipUnless
from
unittest
import
TestCase
,
skipUnless
...
@@ -25,8 +26,7 @@ class TestModules(TestCase):
...
@@ -25,8 +26,7 @@ class TestModules(TestCase):
self
.
assertEqual
(
getattr
(
c_heapq
,
fname
).
__module__
,
'_heapq'
)
self
.
assertEqual
(
getattr
(
c_heapq
,
fname
).
__module__
,
'_heapq'
)
class
TestHeap
(
TestCase
):
class
TestHeap
:
module
=
None
def
test_push_pop
(
self
):
def
test_push_pop
(
self
):
# 1) Push 256 random numbers and pop them off, verifying all's OK.
# 1) Push 256 random numbers and pop them off, verifying all's OK.
...
@@ -214,12 +214,12 @@ class TestHeap(TestCase):
...
@@ -214,12 +214,12 @@ class TestHeap(TestCase):
self
.
assertRaises
(
TypeError
,
data
,
LE
)
self
.
assertRaises
(
TypeError
,
data
,
LE
)
class
TestHeapPython
(
TestHeap
):
class
TestHeapPython
(
TestHeap
,
TestCase
):
module
=
py_heapq
module
=
py_heapq
@
skipUnless
(
c_heapq
,
'requires _heapq'
)
@
skipUnless
(
c_heapq
,
'requires _heapq'
)
class
TestHeapC
(
TestHeap
):
class
TestHeapC
(
TestHeap
,
TestCase
):
module
=
c_heapq
module
=
c_heapq
...
@@ -319,8 +319,7 @@ def L(seqn):
...
@@ -319,8 +319,7 @@ def L(seqn):
return
chain
(
map
(
lambda
x
:
x
,
R
(
Ig
(
G
(
seqn
)))))
return
chain
(
map
(
lambda
x
:
x
,
R
(
Ig
(
G
(
seqn
)))))
class
TestErrorHandling
(
TestCase
):
class
TestErrorHandling
:
module
=
None
def
test_non_sequence
(
self
):
def
test_non_sequence
(
self
):
for
f
in
(
self
.
module
.
heapify
,
self
.
module
.
heappop
):
for
f
in
(
self
.
module
.
heapify
,
self
.
module
.
heappop
):
...
@@ -371,31 +370,13 @@ class TestErrorHandling(TestCase):
...
@@ -371,31 +370,13 @@ class TestErrorHandling(TestCase):
self
.
assertRaises
(
ZeroDivisionError
,
f
,
2
,
E
(
s
))
self
.
assertRaises
(
ZeroDivisionError
,
f
,
2
,
E
(
s
))
class
TestErrorHandlingPython
(
TestErrorHandling
):
class
TestErrorHandlingPython
(
TestErrorHandling
,
TestCase
):
module
=
py_heapq
module
=
py_heapq
@
skipUnless
(
c_heapq
,
'requires _heapq'
)
@
skipUnless
(
c_heapq
,
'requires _heapq'
)
class
TestErrorHandlingC
(
TestErrorHandling
):
class
TestErrorHandlingC
(
TestErrorHandling
,
TestCase
):
module
=
c_heapq
module
=
c_heapq
#==============================================================================
def
test_main
(
verbose
=
None
):
test_classes
=
[
TestModules
,
TestHeapPython
,
TestHeapC
,
TestErrorHandlingPython
,
TestErrorHandlingC
]
support
.
run_unittest
(
*
test_classes
)
# verify reference counting
if
verbose
and
hasattr
(
sys
,
"gettotalrefcount"
):
import
gc
counts
=
[
None
]
*
5
for
i
in
range
(
len
(
counts
)):
support
.
run_unittest
(
*
test_classes
)
gc
.
collect
()
counts
[
i
]
=
sys
.
gettotalrefcount
()
print
(
counts
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
test_main
(
verbose
=
True
)
unittest
.
main
(
)
Misc/NEWS
View file @
22ebb2d6
...
@@ -381,6 +381,8 @@ Library
...
@@ -381,6 +381,8 @@ Library
Tests
Tests
-----
-----
-
Issue
#
16748
:
test_heapq
now
works
with
unittest
test
discovery
.
-
Issue
#
15324
:
Fix
regrtest
parsing
of
--
fromfile
,
--
match
,
and
--
randomize
-
Issue
#
15324
:
Fix
regrtest
parsing
of
--
fromfile
,
--
match
,
and
--
randomize
options
.
options
.
...
...
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