Kaydet (Commit) c585eecf authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Fix test that depends on a particular implementation of random.choice().

üst a300007c
...@@ -136,7 +136,7 @@ class Random(_random.Random): ...@@ -136,7 +136,7 @@ class Random(_random.Random):
# really unsigned 32-bit ints, so we convert negative ints from # really unsigned 32-bit ints, so we convert negative ints from
# version 2 to positive longs for version 3. # version 2 to positive longs for version 3.
try: try:
internalstate = tuple( x % (2**32) for x in internalstate ) internalstate = tuple(x % (2**32) for x in internalstate)
except ValueError as e: except ValueError as e:
raise TypeError from e raise TypeError from e
super(Random, self).setstate(internalstate) super(Random, self).setstate(internalstate)
...@@ -214,10 +214,7 @@ class Random(_random.Random): ...@@ -214,10 +214,7 @@ class Random(_random.Random):
def _randbelow(self, n, int=int, _maxwidth=1<<BPF, type=type, def _randbelow(self, n, int=int, _maxwidth=1<<BPF, type=type,
_Method=_MethodType, _BuiltinMethod=_BuiltinMethodType): _Method=_MethodType, _BuiltinMethod=_BuiltinMethodType):
"""Return a random int in the range [0,n) """Return a random int in the range [0,n). Raises ValueError if n==0.
Handles the case where n has more bits than returned
by a single call to the underlying generator.
""" """
getrandbits = self.getrandbits getrandbits = self.getrandbits
......
...@@ -458,30 +458,30 @@ Subject: Re: PEP 255: Simple Generators ...@@ -458,30 +458,30 @@ Subject: Re: PEP 255: Simple Generators
... else: ... else:
... break ... 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 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 merged K into B
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 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 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 A into F 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 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 H into G merged E into F
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 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 F into J merged D 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->M 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 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 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 G merged J into B
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 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 C into G merged B into C
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->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 ' # Emacs turd '
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment