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
Start unit testing #6
Conversation
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 for this. It looks great! Just one minor comment in the code.
Also, please do can add the instructions for running the test in the main README file. Create a new subsection before "Contributing" and add it there.
import unittest | ||
import dpu_utils.codeutils.identifiersplitting as split | ||
|
||
class TestSplitCamelCase(unittest.TestCase): |
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.
Could you rename this to TestIdentifierSplitting
? (the test actually includes cases of snake_case)
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 class actually only tests the split_camelcase()
function. The snake_case
test was just testing the case of splitting out underscores (i.e. snake_case
-> ["snake", "_", "case"]
), but I think that idea is sufficiently covered by test_special_characters_are_split()
, so I deleted the snake_case
test.
I was planning on making another class in a separate PR for testing split_identifier_into_parts()
since it handles snake case and uppercase characters differently than split_camelcase()
. Would you prefer if that was grouped into the same class / do you still want me to rename the class?
@mallamanis I added instructions to the README and commented on that thing in the code! |
@jdayton3 Thanks a lot! Greatly appreciate your effort. Looking forward to more :) |
I set up the
tests/
directory and wrote some unit tests for thedpu_utils.codeutils.identifiersplitting.split_camelcase()
function. Thetests/
directory has the same file/directory structure as thedpu_utils/
directory. The only difference is that for a package calledthing.py
, the corresponding test is calledtest_thing.py
.Tests can be run with:
python setup.py test
Code coverage can be generated and viewed with:
Is there a place in the
README
or another file where this ⬆️ should be documented?(Closes #5)