Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
ba5da943
Kaydet (Commit)
ba5da943
authored
Nis 19, 2013
tarafından
Ezio Melotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
#17789: merge with 3.3.
üst
a1081126
3e4a98bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
27 deletions
+15
-27
test_random.py
Lib/test/test_random.py
+12
-27
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_random.py
Dosyayı görüntüle @
ba5da943
...
...
@@ -10,7 +10,7 @@ from functools import partial
from
math
import
log
,
exp
,
pi
,
fsum
,
sin
from
test
import
support
class
TestBasicOps
(
unittest
.
TestCase
)
:
class
TestBasicOps
:
# Superclass with tests common to all generators.
# Subclasses must arrange for self.gen to retrieve the Random instance
# to be tested.
...
...
@@ -188,7 +188,15 @@ class TestBasicOps(unittest.TestCase):
k
=
sum
(
randrange
(
6755399441055744
)
%
3
==
2
for
i
in
range
(
n
))
self
.
assertTrue
(
0.30
<
k
/
n
<
.
37
,
(
k
/
n
))
class
SystemRandom_TestBasicOps
(
TestBasicOps
):
try
:
random
.
SystemRandom
()
.
random
()
except
NotImplementedError
:
SystemRandom_available
=
False
else
:
SystemRandom_available
=
True
@unittest.skipUnless
(
SystemRandom_available
,
"random.SystemRandom not available"
)
class
SystemRandom_TestBasicOps
(
TestBasicOps
,
unittest
.
TestCase
):
gen
=
random
.
SystemRandom
()
def
test_autoseed
(
self
):
...
...
@@ -304,7 +312,7 @@ class SystemRandom_TestBasicOps(TestBasicOps):
self
.
assertTrue
(
2
**
k
>
n
>
2
**
(
k
-
1
))
# note the stronger assertion
class
MersenneTwister_TestBasicOps
(
TestBasicOps
):
class
MersenneTwister_TestBasicOps
(
TestBasicOps
,
unittest
.
TestCase
):
gen
=
random
.
Random
()
def
test_guaranteed_stable
(
self
):
...
...
@@ -749,28 +757,5 @@ class TestModule(unittest.TestCase):
Subclass
(
newarg
=
1
)
def
test_main
(
verbose
=
None
):
testclasses
=
[
MersenneTwister_TestBasicOps
,
TestDistributions
,
TestModule
]
try
:
random
.
SystemRandom
()
.
random
()
except
NotImplementedError
:
pass
else
:
testclasses
.
append
(
SystemRandom_TestBasicOps
)
support
.
run_unittest
(
*
testclasses
)
# verify reference counting
import
sys
if
verbose
and
hasattr
(
sys
,
"gettotalrefcount"
):
counts
=
[
None
]
*
5
for
i
in
range
(
len
(
counts
)):
support
.
run_unittest
(
*
testclasses
)
counts
[
i
]
=
sys
.
gettotalrefcount
()
print
(
counts
)
if
__name__
==
"__main__"
:
test_main
(
verbose
=
True
)
unittest
.
main
(
)
Misc/NEWS
Dosyayı görüntüle @
ba5da943
...
...
@@ -134,6 +134,9 @@ Tests
-
Issue
#
12820
:
add
tests
for
the
xml
.
dom
.
minicompat
module
.
Patch
by
John
Chandler
and
Phil
Connell
.
-
Issue
#
17789
:
test_random
now
works
with
unittest
test
discovery
.
Patch
by
Zachary
Ware
.
-
Issue
#
17779
:
test_osx_env
now
works
with
unittest
test
discovery
.
Patch
by
Zachary
Ware
.
...
...
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