Skip to content

Conversation

@mrsaicharan1
Copy link
Member

@mrsaicharan1 mrsaicharan1 commented Jul 21, 2019

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:

  • Refactor empty_string
  • Add more test cases for empty_string

Checklist

  • I have read the Contribution & Best practices Guide and my PR follows them.
  • My branch is up-to-date with the Upstream development branch.
  • The unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • All the functions created/modified in this PR contain relevant docstrings.

@codecov
Copy link

codecov bot commented Jul 21, 2019

Codecov Report

❗ No coverage uploaded for pull request base (development@1f91603). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@              Coverage Diff               @@
##             development    #6222   +/-   ##
==============================================
  Coverage               ?   65.88%           
==============================================
  Files                  ?      288           
  Lines                  ?    14573           
  Branches               ?        0           
==============================================
  Hits                   ?     9602           
  Misses                 ?     4971           
  Partials               ?        0
Impacted Files Coverage Δ
...ests/all/integration/api/helpers/test_utilities.py 97.72% <ø> (ø)
tests/all/unit/api/helpers/test_utilities.py 96.15% <100%> (ø)
app/api/helpers/utilities.py 69.11% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1f91603...f861f49. Read the comment docs.

@mrsaicharan1 mrsaicharan1 force-pushed the refactor-3 branch 2 times, most recently from 9133fdd to 65ae50a Compare July 21, 2019 18:51
@mrsaicharan1
Copy link
Member Author

@iamareebjamal Moved to unit, restored test cases. Please have a look.

@fossasia fossasia deleted a comment Jul 21, 2019
self.assertTrue(string_empty(' '))
self.assertTrue(string_empty(' '))
self.assertTrue(string_empty('\n'))
self.assertFalse(string_empty(None))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be true IMO

Copy link
Member Author

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?

Copy link
Member

@iamareebjamal iamareebjamal Jul 22, 2019

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

Copy link
Member Author

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'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add tabs as well

Copy link
Member Author

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
@iamareebjamal iamareebjamal merged commit 4467fe3 into fossasia:development Jul 22, 2019
iamareebjamal pushed a commit to iamareebjamal/open-event-server that referenced this pull request Aug 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

empty_string() needs a rewrite

3 participants