-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Increase apparent test coverage by removing superfluous ellipses #142
base: enh/run-clone
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## enh/run-clone #142 +/- ##
===============================================
+ Coverage 87.1% 88.4% +1.3%
===============================================
Files 231 231
Lines 8216 8093 -123
===============================================
Hits 7160 7160
+ Misses 1056 933 -123 |
Hmm, so what you are saying does check out. The ellipses is not really strictly required. from typing import Protocol
class A(Protocol):
def f(self):
"""This is a docstring"""
...
class B(A): ...
B().f()
# ^ Cannot instantiate abstract class "B" with abstract attribute "f" And alike: from typing import Protocol
class A(Protocol):
def f(self):
"""This is a docstring"""
class B(A): ...
B().f()
# ^ Cannot instantiate abstract class "B" with abstract attribute "f" However as soon as |
I'm not sure I understand the problem with this. I created your example in the mypy playground, so please feel free to experiment with that. Please let me know what I'm missing about this. |
73b59c6
to
0975ce3
Compare
f996fb5
to
64d7787
Compare
Im not sure i understand the /benefit/ of this. IMO the ellipsis adds semantic value as in "this space intentionally left blank". |
Ideally, as I understand it, we should push for 100% test coverage (and more, since even calling each single line in the tests might not guarantee that it works as intended for various inputs). Codecov also counts lines containing only
We don't have to merge this version, of course. I think an empty function body conveys intent as well as |
Maybe this is a solution that doesn't make us both unhappy: nedbat/coveragepy#1042 (comment) |
64d7787
to
1885f0c
Compare
This is essentially the first option from my list :) It's 88.4%, so slightly better than expected. From the details view, I can't immediately tell the difference, maybe I forgot a line or two? Either way, the result seems fine :) |
Yesterday I learned that one does not need to put any code inside a function that has a docstring. This allows us to remove numerous lines in the abstract layer that just contain
...
and are counted by test coverage as missing lines. Removing them should not affect any kind of behaviour or how the docs look, but increase the apparent test coverage :)