summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_statistics.py
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2019-02-24 06:19:01 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-02-24 06:19:01 (GMT)
commit79fbcc597dfd039d3261fffcb519b5ec5a18df9d (patch)
tree9d56ae7f0a317d315533aac7ae2efd425a9efb05 /Lib/test/test_statistics.py
parente895de3e7f3cc2f7213b87621cfe9812ea4343f0 (diff)
downloadcpython-79fbcc597dfd039d3261fffcb519b5ec5a18df9d.zip
cpython-79fbcc597dfd039d3261fffcb519b5ec5a18df9d.tar.gz
cpython-79fbcc597dfd039d3261fffcb519b5ec5a18df9d.tar.bz2
bpo-36018: Make __pos__ return a distinct instance of NormDist (GH-12009)
https://bugs.python.org/issue36018
Diffstat (limited to 'Lib/test/test_statistics.py')
-rw-r--r--Lib/test/test_statistics.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_statistics.py b/Lib/test/test_statistics.py
index a65fbe8..9549240 100644
--- a/Lib/test/test_statistics.py
+++ b/Lib/test/test_statistics.py
@@ -2128,6 +2128,18 @@ class TestNormalDist(unittest.TestCase):
with self.assertRaises(statistics.StatisticsError):
Y.cdf(90)
+ def test_unary_operations(self):
+ NormalDist = statistics.NormalDist
+ X = NormalDist(100, 12)
+ Y = +X
+ self.assertIsNot(X, Y)
+ self.assertEqual(X.mu, Y.mu)
+ self.assertEqual(X.sigma, Y.sigma)
+ Y = -X
+ self.assertIsNot(X, Y)
+ self.assertEqual(X.mu, -Y.mu)
+ self.assertEqual(X.sigma, Y.sigma)
+
def test_same_type_addition_and_subtraction(self):
NormalDist = statistics.NormalDist
X = NormalDist(100, 12)