-
Notifications
You must be signed in to change notification settings - Fork 1.9k
refactor: Rewrite empty_string & add more test cases #6222
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
Conversation
Codecov Report
@@ Coverage Diff @@
## development #6222 +/- ##
==============================================
Coverage ? 65.88%
==============================================
Files ? 288
Lines ? 14573
Branches ? 0
==============================================
Hits ? 9602
Misses ? 4971
Partials ? 0
Continue to review full report at Codecov.
|
9133fdd to
65ae50a
Compare
|
@iamareebjamal Moved to unit, restored test cases. Please have a look. |
| self.assertTrue(string_empty(' ')) | ||
| self.assertTrue(string_empty(' ')) | ||
| self.assertTrue(string_empty('\n')) | ||
| self.assertFalse(string_empty(None)) |
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.
Should be true IMO
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.
None isn't str object I believe?
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 lot of times None can be passed for a string. We need to treat it as en empty string. For example, non-existent field. If we are using string_empty for validation, then having None as non empty will pass it as a correct value
However, this needs to be checked where string_empty is used so that we can ensure the correct behaviour
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.
Travis was failing when I did that. What could be done?
| self.assertTrue(string_empty('')) | ||
| self.assertTrue(string_empty(' ')) | ||
| self.assertTrue(string_empty(' ')) | ||
| self.assertTrue(string_empty('\n')) |
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.
Add tabs as well
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.
Added
Shifted test to unit dir Added tabs
Shifted test to unit dir Added tabs
Fixes #6221
Short description of what this resolves:
Refactor helper function in accordance with python3 & add more test cases
Changes proposed in this pull request:
empty_stringChecklist
developmentbranch.