Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
5eabec02
Commit
5eabec02
authored
Oct 18, 2019
by
Raymond Hettinger
Committed by
GitHub
Oct 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-38521: Fix error in NormalDist.__eq__() (GH-16840)
parent
ecb035cd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
1 deletion
+6
-1
Lib/statistics.py
Lib/statistics.py
+1
-1
Lib/test/test_statistics.py
Lib/test/test_statistics.py
+4
-0
Misc/NEWS.d/next/Library/2019-10-18-13-57-31.bpo-38521.U-7aaM.rst
...S.d/next/Library/2019-10-18-13-57-31.bpo-38521.U-7aaM.rst
+1
-0
No files found.
Lib/statistics.py
View file @
5eabec02
...
...
@@ -1092,7 +1092,7 @@ class NormalDist:
"Two NormalDist objects are equal if their mu and sigma are both equal."
if
not
isinstance
(
x2
,
NormalDist
):
return
NotImplemented
return
(
x1
.
_mu
,
x2
.
_sigma
)
==
(
x2
.
_mu
,
x2
.
_sigma
)
return
x1
.
_mu
==
x2
.
_mu
and
x1
.
_sigma
==
x2
.
_sigma
def
__hash__
(
self
):
"NormalDist objects hash equal if their mu and sigma are both equal."
...
...
Lib/test/test_statistics.py
View file @
5eabec02
...
...
@@ -2651,9 +2651,13 @@ class TestNormalDist:
nd2
=
NormalDist
(
2
,
4
)
nd3
=
NormalDist
()
nd4
=
NormalDist
(
2
,
4
)
nd5
=
NormalDist
(
2
,
8
)
nd6
=
NormalDist
(
8
,
4
)
self
.
assertNotEqual
(
nd1
,
nd2
)
self
.
assertEqual
(
nd1
,
nd3
)
self
.
assertEqual
(
nd2
,
nd4
)
self
.
assertNotEqual
(
nd2
,
nd5
)
self
.
assertNotEqual
(
nd2
,
nd6
)
# Test NotImplemented when types are different
class
A
:
...
...
Misc/NEWS.d/next/Library/2019-10-18-13-57-31.bpo-38521.U-7aaM.rst
0 → 100644
View file @
5eabec02
Fixed erroneous equality comparison in statistics.NormalDist().
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