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

Fix the datetime-to-str converters #937

Merged
merged 1 commit into from
Mar 16, 2020

Conversation

mdickinson
Copy link
Member

This PR fixes the datetime to-and-from string conversions used in the DatetimeEditor:

  • For str-to-datetime, allow the empty string to be converted to None (a Datetime trait allows None by default)
  • For str-to-datetime, we can reasonably assume that the argument is a string, so the is not None check is pointless. Remove it.
  • For datetime-to-str, make sure we always return a string, returning the empty string for an input of None.

Fixes #936

@codecov-io
Copy link

Codecov Report

Merging #937 into master will increase coverage by 0.20%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #937      +/-   ##
==========================================
+ Coverage   72.90%   73.11%   +0.20%     
==========================================
  Files          51       51              
  Lines        6456     6458       +2     
  Branches     1301     1301              
==========================================
+ Hits         4707     4722      +15     
+ Misses       1357     1341      -16     
- Partials      392      395       +3     
Impacted Files Coverage Δ
traits/editor_factories.py 79.59% <0.00%> (-4.79%) ⬇️
traits/trait_types.py 71.07% <0.00%> (-0.16%) ⬇️
traits/traits.py 76.92% <0.00%> (+4.04%) ⬆️
traits/etsconfig/etsconfig.py 63.46% <0.00%> (+6.41%) ⬆️

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 160bd8a...cc5d84c. Read the comment docs.

Copy link
Contributor

@kitchoi kitchoi left a comment

Choose a reason for hiding this comment

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

LGTM

@mdickinson mdickinson merged commit fbf08dc into master Mar 16, 2020
@mdickinson mdickinson deleted the fix/datetime-to-str-conversions branch March 16, 2020 13:30
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.

_datetime_to_datetime_str should not return None
3 participants