[Python-checkins] cpython: Close #28476: Reuse math.factorial() in test_random

victor.stinner python-checkins at python.org
Wed Oct 19 04:13:06 EDT 2016


https://hg.python.org/cpython/rev/c6588a7443a4
changeset: 104549:c6588a7443a4
user: Victor Stinner <victor.stinner at gmail.com>
date: Wed Oct 19 10:11:37 2016 +0200
summary:
 Close #28476: Reuse math.factorial() in test_random
Patch written by Francisco Couzo.
files:
 Lib/test/test_random.py | 6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py
--- a/Lib/test/test_random.py
+++ b/Lib/test/test_random.py
@@ -5,7 +5,7 @@
 import pickle
 import warnings
 from functools import partial
-from math import log, exp, pi, fsum, sin
+from math import log, exp, pi, fsum, sin, factorial
 from test import support
 from fractions import Fraction
 
@@ -117,10 +117,6 @@
 n = 5
 pop = range(n)
 trials = 10000 # large num prevents false negatives without slowing normal case
- def factorial(n):
- if n == 0:
- return 1
- return n * factorial(n - 1)
 for k in range(n):
 expected = factorial(n) // factorial(n-k)
 perms = {}
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /