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
49ed08fd
Commit
49ed08fd
authored
Apr 18, 2016
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Plain Diff
typing.py: merge 3.5->3.6 (Tuple/ellipsis/equality).
parents
27e1240a
5abcbb3e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
Lib/test/test_typing.py
Lib/test/test_typing.py
+6
-0
Lib/typing.py
Lib/typing.py
+2
-1
No files found.
Lib/test/test_typing.py
View file @
49ed08fd
...
@@ -359,6 +359,12 @@ class TupleTests(TestCase):
...
@@ -359,6 +359,12 @@ class TupleTests(TestCase):
self
.
assertTrue
(
issubclass
(
tuple
,
Tuple
))
self
.
assertTrue
(
issubclass
(
tuple
,
Tuple
))
self
.
assertFalse
(
issubclass
(
Tuple
,
tuple
))
# Can't have it both ways.
self
.
assertFalse
(
issubclass
(
Tuple
,
tuple
))
# Can't have it both ways.
def
test_equality
(
self
):
assert
Tuple
[
int
]
==
Tuple
[
int
]
assert
Tuple
[
int
,
...]
==
Tuple
[
int
,
...]
assert
Tuple
[
int
]
!=
Tuple
[
int
,
int
]
assert
Tuple
[
int
]
!=
Tuple
[
int
,
...]
def
test_tuple_subclass
(
self
):
def
test_tuple_subclass
(
self
):
class
MyTuple
(
tuple
):
class
MyTuple
(
tuple
):
pass
pass
...
...
Lib/typing.py
View file @
49ed08fd
...
@@ -705,7 +705,8 @@ class TupleMeta(TypingMeta):
...
@@ -705,7 +705,8 @@ class TupleMeta(TypingMeta):
def
__eq__
(
self
,
other
):
def
__eq__
(
self
,
other
):
if
not
isinstance
(
other
,
TupleMeta
):
if
not
isinstance
(
other
,
TupleMeta
):
return
NotImplemented
return
NotImplemented
return
self
.
__tuple_params__
==
other
.
__tuple_params__
return
(
self
.
__tuple_params__
==
other
.
__tuple_params__
and
self
.
__tuple_use_ellipsis__
==
other
.
__tuple_use_ellipsis__
)
def
__hash__
(
self
):
def
__hash__
(
self
):
return
hash
(
self
.
__tuple_params__
)
return
hash
(
self
.
__tuple_params__
)
...
...
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