Skip to content

Conversation

samuelcolvin
Copy link
Member

@samuelcolvin samuelcolvin commented Aug 18, 2019

Change Summary

While working on #763 I discovered that we had no tests and ugly errors if anything other than a native datetime/date/time/timedelta, string, int or float was passed to those parsers.

Changes:

  • fix the above - more descriptive error message
  • add support for bytes by decoding them before regex matching
  • change invalid values to be value_errors not type_errors - more correct.

Github doesn't do a very good job of showing it, but this change is mainly just an indentation change plus adding if isinstance(value, bytes): value = value.decode().

Checklist

  • Unit tests for the changes exist
  • Tests pass on CI and coverage remains at 100%
  • Documentation reflects the changes where applicable
  • changes/<pull request or issue id>-<github username>.rst file added describing change
    (see changes/README.md for details)

@codecov
Copy link

codecov bot commented Aug 21, 2019

Codecov Report

Merging #766 into master will not change coverage.
The diff coverage is 100%.

@@          Coverage Diff          @@
##           master   #766   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          15     15           
  Lines        2734   2747   +13     
  Branches      541    546    +5     
=====================================
+ Hits         2734   2747   +13
Impacted Files Coverage Δ
pydantic/errors.py 100% <100%> (ø) ⬆️
pydantic/datetime_parse.py 100% <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 0e8cfba...74c597a. Read the comment docs.

@samuelcolvin samuelcolvin merged commit 9dee83a into master Aug 21, 2019
@samuelcolvin samuelcolvin deleted the datetime-type-errors branch August 21, 2019 12:45
alexdrydew pushed a commit to alexdrydew/pydantic that referenced this pull request Dec 23, 2023
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.

1 participant