]> granicus.if.org Git - python/commitdiff
Close #28476: Reuse math.factorial() in test_random
authorVictor Stinner <victor.stinner@gmail.com>
Wed, 19 Oct 2016 08:11:37 +0000 (10:11 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Wed, 19 Oct 2016 08:11:37 +0000 (10:11 +0200)
Patch written by Francisco Couzo.

Lib/test/test_random.py

index 4d5a8749c76c05a993239cd284a7767fa6bc94da..d061829aa028fa90da7ea546ed0e2eb53d3a403d 100644 (file)
@@ -5,7 +5,7 @@ import time
 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 @@ class TestBasicOps:
         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 = {}