Skip to content
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

Merged
merged 4 commits into from Oct 29, 2018
Merged

Start unit testing #6

merged 4 commits into from Oct 29, 2018

Conversation

jdayton3
Copy link
Contributor

I set up the tests/ directory and wrote some unit tests for the dpu_utils.codeutils.identifiersplitting.split_camelcase() function. The tests/ directory has the same file/directory structure as the dpu_utils/ directory. The only difference is that for a package called thing.py, the corresponding test is called test_thing.py.

Tests can be run with:

python setup.py test

Code coverage can be generated and viewed with:

# pip install coverage
coverage run --source dpu_utils/ setup.py test && \
  coverage html && \
  see htmlcov/index.html

Is there a place in the README or another file where this ⬆️ should be documented?

(Closes #5)

@msftclas
Copy link

msftclas commented Oct 26, 2018

CLA assistant check
All CLA requirements met.

Copy link
Contributor

@mallamanis mallamanis left a 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):
Copy link
Contributor

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)

Copy link
Contributor Author

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?

@jdayton3
Copy link
Contributor Author

@mallamanis I added instructions to the README and commented on that thing in the code!

@mallamanis mallamanis merged commit 63030dd into microsoft:master Oct 29, 2018
@mallamanis
Copy link
Contributor

@jdayton3 Thanks a lot! Greatly appreciate your effort. Looking forward to more :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants