summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2019-02-28 17:16:25 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-02-28 17:16:25 (GMT)
commitef17fdbc1c274dc84c2f611c40449ab84824607e (patch)
tree10619b6016709e2339455421d15c4b9bac2fd2c4 /Lib/test
parentae2ea33d5da34a777e77d489b700ff45d753934f (diff)
downloadcpython-ef17fdbc1c274dc84c2f611c40449ab84824607e.zip
cpython-ef17fdbc1c274dc84c2f611c40449ab84824607e.tar.gz
cpython-ef17fdbc1c274dc84c2f611c40449ab84824607e.tar.bz2
bpo-36018: Add special value tests and make minor tweaks to the docs (GH-12096)
https://bugs.python.org/issue36018
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_statistics.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_statistics.py b/Lib/test/test_statistics.py
index d35cdd8..4adc5e4 100644
--- a/Lib/test/test_statistics.py
+++ b/Lib/test/test_statistics.py
@@ -2113,6 +2113,10 @@ class TestNormalDist(unittest.TestCase):
Y = NormalDist(100, 0)
with self.assertRaises(statistics.StatisticsError):
Y.pdf(90)
+ # Special values
+ self.assertEqual(X.pdf(float('-Inf')), 0.0)
+ self.assertEqual(X.pdf(float('Inf')), 0.0)
+ self.assertTrue(math.isnan(X.pdf(float('NaN'))))
def test_cdf(self):
NormalDist = statistics.NormalDist
@@ -2127,6 +2131,10 @@ class TestNormalDist(unittest.TestCase):
Y = NormalDist(100, 0)
with self.assertRaises(statistics.StatisticsError):
Y.cdf(90)
+ # Special values
+ self.assertEqual(X.cdf(float('-Inf')), 0.0)
+ self.assertEqual(X.cdf(float('Inf')), 1.0)
+ self.assertTrue(math.isnan(X.cdf(float('NaN'))))
def test_properties(self):
X = statistics.NormalDist(100, 15)