-
Notifications
You must be signed in to change notification settings - Fork 11
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
Extractor #57
Extractor #57
Conversation
0366315
to
8511115
Compare
Codecov Report
@@ Coverage Diff @@
## master #57 +/- ##
==========================================
+ Coverage 92.12% 93.18% +1.06%
==========================================
Files 6 7 +1
Lines 165 176 +11
==========================================
+ Hits 152 164 +12
+ Misses 13 12 -1
Continue to review full report at Codecov.
|
@rohts-patil, @Sharad24 Can you tell me how is this different from the OOP - implementation of Perturbations, its stuck at the code-coverage for the abstract class |
tests/test_extractor_basic.py
Outdated
@@ -0,0 +1,30 @@ | |||
_author_ = "Somesh Singh" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still there, codecov shows errors at the abstract class methods idk why
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What?
tests/test_extractor_basic.py
Outdated
assert random_extractor.extract(words, top_k=2) == expected_result | ||
|
||
|
||
def random_empty_extract(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pytest can only identify functions/classes starting with test
/Test
, etc
Rename this to test_random_empty_extract
and it should work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the issue. @someshsingh22
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, that makes sense, I thought it's true only for filenames
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks !
decepticonlp/extractor/basic.py
Outdated
""" | ||
|
||
@abc.abstractmethod | ||
def extract(self, words: list, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
Missing argument docstrings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also since this function should never be tested, you should add pragma: no cover
in front of it. pytest ignores its count in code coverage.
def extract(self, words: list, **kwargs): #pragma: no cover
Any reason to force push btw? |
Reduces unnecessary commits, I wanted this to be a reference PR, for whenever you want to implement a new OOP Module |
I have added pragma in this PR, any where else ? |
Only functions with a decorator of an abstract method need to have pragma no cover. The other functions you've labelled as pragma no cover do get called when testing |
decepticonlp/extractor/basic.py
Outdated
:params: | ||
:words: - List of Words | ||
:top_k: - Number of words to be extracted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the corrent syntax for docstrings, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""
A class used to apply random word extractor.
Methods
-------
extract(self, words: list, top_k = 1, **kwargs)
- extracts top_k random words and returns their index.
Parameters
--------
words - List of words.
top_k - Number of words to be extracted
"""
Changed to this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think its ok for now
You also need to change the pytest command in travis. Add |
.travis.yml
Outdated
@@ -15,6 +15,6 @@ install: | |||
script: | |||
- black --check decepticonlp | |||
- black --check tests | |||
- pytest --cov='./decepticonlp/' | |||
- pytest --cov-config=.coveragerc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command should be pytest --cov='./decepticonlp/' --cov-config=.coveragerc
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
:) |
Commit 1 - Basic Random Extractor Module
Commit 2 - Basic OOP Random Extractor Module
Commit 3 - Unit Testing
Commit 4 - Assertion Errors, Minor Fixes from Travis Log
Commit 5 - Pragma added
Commit 6 - .coveragerc Added
Note - Would Recommend Not to squash, can serve as "How To" for OOP implementations