mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 03:02:52 +01:00
Added a test for random.choice behavior.
This commit is contained in:
parent
b6066a1543
commit
f61591016b
@ -49,7 +49,7 @@ string.ascii = string.maketrans('', '')
|
||||
import random
|
||||
_choice = random.choice
|
||||
def choice(iterable):
|
||||
if isinstance(iterable, list):
|
||||
if isinstance(iterable, (list, tuple)):
|
||||
return _choice(iterable)
|
||||
else:
|
||||
n = 1
|
||||
|
@ -31,9 +31,13 @@
|
||||
|
||||
from testsupport import *
|
||||
|
||||
import random
|
||||
import itertools
|
||||
|
||||
class FunctionsTest(SupyTestCase):
|
||||
def testRandomChoice(self):
|
||||
self.assertRaises(IndexError, random.choice, {})
|
||||
|
||||
def testReversed(self):
|
||||
L = range(10)
|
||||
revL = list(reversed(L))
|
||||
|
Loading…
Reference in New Issue
Block a user