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
105b084b
Commit
105b084b
authored
Feb 04, 2003
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add refcount test.
parent
fa05ce3c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
Lib/test/test_random.py
Lib/test/test_random.py
+12
-3
No files found.
Lib/test/test_random.py
View file @
105b084b
...
...
@@ -74,7 +74,7 @@ class TestBasicOps(unittest.TestCase):
pop
=
range
(
n
)
trials
=
10000
# large num prevents false negatives without slowing normal case
def
factorial
(
n
):
return
n
==
0
and
1
or
n
*
factorial
(
n
-
1
)
return
reduce
(
int
.
__mul__
,
xrange
(
1
,
n
),
1
)
for
k
in
xrange
(
n
):
expected
=
factorial
(
n
)
/
factorial
(
n
-
k
)
perms
=
{}
...
...
@@ -271,7 +271,7 @@ class TestModule(unittest.TestCase):
# tests validity but not completeness of the __all__ list
self
.
failUnless
(
Set
(
random
.
__all__
)
<=
Set
(
dir
(
random
)))
def
test_main
():
def
test_main
(
verbose
=
None
):
suite
=
unittest
.
TestSuite
()
for
testclass
in
(
WichmannHill_TestBasicOps
,
MersenneTwister_TestBasicOps
,
...
...
@@ -280,5 +280,14 @@ def test_main():
suite
.
addTest
(
unittest
.
makeSuite
(
testclass
))
test_support
.
run_suite
(
suite
)
# verify reference counting
import
sys
if
verbose
and
hasattr
(
sys
,
"gettotalrefcount"
):
counts
=
[]
for
i
in
xrange
(
5
):
test_support
.
run_suite
(
suite
)
counts
.
append
(
sys
.
gettotalrefcount
()
-
i
)
print
counts
if
__name__
==
"__main__"
:
test_main
()
test_main
(
verbose
=
True
)
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