Conversation
d686377 to
7ece722
Compare
58e8130 to
aa22b98
Compare
9f5c185 to
678c257
Compare
JelleZijlstra
left a comment
There was a problem hiding this comment.
- Can you also set
tvt.__bound__ = boundfor consistency? - Can you add tests and a changelog entry?
678c257 to
7d45019
Compare
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #741 +/- ##
===========================================
- Coverage 97.38% 83.45% -13.94%
===========================================
Files 3 3
Lines 7690 7741 +51
===========================================
- Hits 7489 6460 -1029
- Misses 201 1281 +1080
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
| def __init__(self, name, *, bound=None, covariant=False, contravariant=False, | ||
| infer_variance=False, default=NoDefault): | ||
| self.__name__ = name | ||
| self.__covariant__ = bool(covariant) |
There was a problem hiding this comment.
Why does this branch call bool() on the variance-related arguments and _type_check on bound and the above one doesn't? We should have things behave the same way across versions.
There was a problem hiding this comment.
the implementation of ParamSpec also has this discrepancy, i will update it accordingly
should _set_default also invoke _type_check?
| self.assertEqual(repr(Ts_contra), '-Ts_contra') | ||
| self.assertEqual(repr(Ts_infer), 'Ts_infer') | ||
| else: | ||
| # Not worth creating our own version of TypeVarTuple |
There was a problem hiding this comment.
I don't understand this comment, we do create our own version in order to add the variance arguments, so we might as well update the repr too.
In general the tests ideally shouldn't have version-dependent branches: it's a goal for typing-extensions for all versions to behave the same.
There was a problem hiding this comment.
it's adapted from the ParamSpec test which does similar. we do create a class for TypeVarTuple, but it doesn't return Self, so we can't update the repr
There was a problem hiding this comment.
typing_extensions/src/test_typing_extensions.py
Line 5769 in 83caa59
cff0290 to
60d6c78
Compare
60d6c78 to
550f1d1
Compare
python/cpython#148212