Commit 9915b938 authored by Fred Drake's avatar Fred Drake

Use the random module instead of the deprecated whrandom module.

whrandom triggers a DeprecationWarning when using CVS Python.
parent d0724306
......@@ -10,7 +10,7 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
import sys, os, time, whrandom, unittest
import sys, os, time, random, unittest
if __name__ == "__main__":
sys.path.insert(0, '../../..')
......@@ -165,7 +165,7 @@ class TestTransientObjectContainer(TestCase):
added = {}
r = range(10, 110)
for x in r:
k = whrandom.choice(r)
k = random.choice(r)
if not added.has_key(k):
self.t[k] = x
added[k] = 1
......@@ -177,7 +177,7 @@ class TestTransientObjectContainer(TestCase):
added = {}
r = range(10, 110)
for x in r:
k = whrandom.choice(r)
k = random.choice(r)
self.t[k] = x
added[k] = 1
addl = added.keys()
......@@ -188,12 +188,12 @@ class TestTransientObjectContainer(TestCase):
r = range(10, 1010)
added = []
for x in r:
k = whrandom.choice(r)
k = random.choice(r)
self.t[k] = x
added.append(k)
deleted = []
for x in r:
k = whrandom.choice(r)
k = random.choice(r)
if self.t.has_key(k):
del self.t[k]
deleted.append(k)
......@@ -208,7 +208,7 @@ class TestTransientObjectContainer(TestCase):
def testTargetedDeletes(self):
r = range(10, 1010)
for x in r:
k = whrandom.choice(r)
k = random.choice(r)
self.t[k] = x
for x in r:
try:
......@@ -372,7 +372,7 @@ class TestTransientObjectContainer(TestCase):
added = {}
r = range(10, 1010)
for x in r:
k = whrandom.choice(r)
k = random.choice(r)
self.t[k] = x
added[k] = x
addl = added.keys()
......
......@@ -11,9 +11,9 @@
#
##############################################################################
__version__='$Revision: 1.64 $'[11:-2]
__version__='$Revision: 1.65 $'[11:-2]
import re, sys, os, urllib, time, whrandom, cgi, codecs
import re, sys, os, urllib, time, random, cgi, codecs
from BaseRequest import BaseRequest
from HTTPResponse import HTTPResponse
from cgi import FieldStorage, escape
......@@ -114,7 +114,7 @@ class HTTPRequest(BaseRequest):
retry_max_count=3
def supports_retry(self):
if self.retry_count < self.retry_max_count:
time.sleep(whrandom.uniform(0, 2**(self.retry_count)))
time.sleep(random.uniform(0, 2**(self.retry_count)))
return 1
def retry(self):
......
"""HTTP 1.1 / WebDAV client library."""
__version__='$Revision: 1.18 $'[11:-2]
__version__='$Revision: 1.19 $'[11:-2]
import sys, os, time, types,re
import socket, httplib, mimetools
......@@ -9,7 +9,7 @@ from mimetypes import guess_type
from base64 import encodestring
from common import rfc1123_date
from cStringIO import StringIO
from whrandom import random
from random import random
from urllib import quote
......
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