Skip to content

Conversation

@samuelcolvin
Copy link
Member

@samuelcolvin samuelcolvin commented Dec 28, 2018

Change Summary

Improve documentation for settings priority and allow them to be more easily changed.

Related issue number

ref #341

Checklist

  • Unit tests for the changes exist
  • Tests pass on CI and coverage remains at 100%
  • Documentation reflects the changes
  • No performance deterioration (if applicable)
  • HISTORY.rst has been updated
    • if this is the first change since a release, please add a new section
    • include the issue number or this pull request number #<number>
    • if you're not a regular contributer please include your github username @whatever

@codecov
Copy link

codecov bot commented Dec 28, 2018

Codecov Report

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

@@          Coverage Diff          @@
##           master   #343   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          14     14           
  Lines        1820   1818    -2     
  Branches      356    356           
=====================================
- Hits         1820   1818    -2

s = Settings(__config_settings__=config, b='argument b', c='argument c')
assert s.a == 'config a'
assert s.b == 'argument b'
assert s.c == 'env setting c'
Copy link

@dbarrosop dbarrosop Dec 29, 2018

Choose a reason for hiding this comment

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

Not sure if I am misreading something but according to the docs the order of preference is class_defaults < env < arguments, however, your test is proving that class_defaults < arguments < env. I might be misreading this completely but my tests seem to confirm this.

Choose a reason for hiding this comment

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

Ok, just realized that your test case is testing changing the order + using the __config_settings__ trick, not the default case. So all is good and I managed to get it working exactly as I wanted, thanks a lot!

@samuelcolvin samuelcolvin merged commit 19320bf into master Dec 29, 2018
@samuelcolvin samuelcolvin deleted the settings-priority branch December 29, 2018 12:31
alexdrydew pushed a commit to alexdrydew/pydantic that referenced this pull request Dec 23, 2023
This implements support for constraining datetime objects based on them
having or not having timezone info. The aware kind constrains to objects
that have timezone info, and symmetrically, the naive kind constrains to
objects that do not have timezone info.
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.

3 participants