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
c585eecf
Commit
c585eecf
authored
Sep 07, 2010
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix test that depends on a particular implementation of random.choice().
parent
a300007c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
27 deletions
+24
-27
Lib/random.py
Lib/random.py
+2
-5
Lib/test/test_generators.py
Lib/test/test_generators.py
+22
-22
No files found.
Lib/random.py
View file @
c585eecf
...
...
@@ -136,7 +136,7 @@ class Random(_random.Random):
# really unsigned 32-bit ints, so we convert negative ints from
# version 2 to positive longs for version 3.
try
:
internalstate
=
tuple
(
x
%
(
2
**
32
)
for
x
in
internalstate
)
internalstate
=
tuple
(
x
%
(
2
**
32
)
for
x
in
internalstate
)
except
ValueError
as
e
:
raise
TypeError
from
e
super
(
Random
,
self
).
setstate
(
internalstate
)
...
...
@@ -214,10 +214,7 @@ class Random(_random.Random):
def
_randbelow
(
self
,
n
,
int
=
int
,
_maxwidth
=
1
<<
BPF
,
type
=
type
,
_Method
=
_MethodType
,
_BuiltinMethod
=
_BuiltinMethodType
):
"""Return a random int in the range [0,n)
Handles the case where n has more bits than returned
by a single call to the underlying generator.
"""Return a random int in the range [0,n). Raises ValueError if n==0.
"""
getrandbits
=
self
.
getrandbits
...
...
Lib/test/test_generators.py
View file @
c585eecf
...
...
@@ -458,30 +458,30 @@ Subject: Re: PEP 255: Simple Generators
... else:
... break
A->A B->B C->C D->D E->E F->F G->G H->H I->I J->J K->K L->L M->M
merged I into A
A->A B->B C->C D->D E->E F->F G->G H->H I->A J->J K->K L->L M->M
merged D into C
A->A B->B C->C D->C E->E F->F G->G H->H I->A J->J K->K L->L M->M
merged K into H
A->A B->B C->C D->C E->E F->F G->G H->H I->A J->J K->H L->L M->M
merged L into A
A->A B->B C->C D->C E->E F->F G->G H->H I->A J->J K->H L->A M->M
merged E into A
A->A B->B C->C D->C E->A F->F G->G H->H I->A J->J K->H L->A M->M
merged B into G
A->A B->G C->C D->C E->A F->F G->G H->H I->A J->J K->H L->A M->M
merged K into B
A->A B->B C->C D->D E->E F->F G->G H->H I->I J->J K->B L->L M->M
merged A into F
A->F B->
G C->C D->C E->F F->F G->G H->H I->F J->J K->H L->F
M->M
merged
H into G
A->F B->
G C->C D->C E->F F->F G->G H->G I->F J->J K->G L->F
M->M
merged
F into J
A->
J B->G C->C D->C E->J F->J G->G H->G I->J J->J K->G L->J
M->M
A->F B->
B C->C D->D E->E F->F G->G H->H I->I J->J K->B L->L
M->M
merged
E into F
A->F B->
B C->C D->D E->F F->F G->G H->H I->I J->J K->B L->L
M->M
merged
D into C
A->
F B->B C->C D->C E->F F->F G->G H->H I->I J->J K->B L->L
M->M
merged M into C
A->J B->G C->C D->C E->J F->J G->G H->G I->J J->J K->G L->J M->C
merged J into G
A->G B->G C->C D->C E->G F->G G->G H->G I->G J->G K->G L->G M->C
merged C into G
A->G B->G C->G D->G E->G F->G G->G H->G I->G J->G K->G L->G M->G
A->F B->B C->C D->C E->F F->F G->G H->H I->I J->J K->B L->L M->C
merged J into B
A->F B->B C->C D->C E->F F->F G->G H->H I->I J->B K->B L->L M->C
merged B into C
A->F B->C C->C D->C E->F F->F G->G H->H I->I J->C K->C L->L M->C
merged F into G
A->G B->C C->C D->C E->G F->G G->G H->H I->I J->C K->C L->L M->C
merged L into C
A->G B->C C->C D->C E->G F->G G->G H->H I->I J->C K->C L->C M->C
merged G into I
A->I B->C C->C D->C E->I F->I G->I H->H I->I J->C K->C L->C M->C
merged I into H
A->H B->C C->C D->C E->H F->H G->H H->H I->H J->C K->C L->C M->C
merged C into H
A->H B->H C->H D->H E->H F->H G->H H->H I->H J->H K->H L->H M->H
"""
# Emacs turd '
...
...
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