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
Add conset #1627
Add conset #1627
Conversation
I'm puzzled. The checks that I fixed in 7dcc248 are still failing, as if nothing changed. Any ideas? |
It looks like linting is failing because lines are too long. Nothing stranger I can see. |
If I'm reading things correctly, the latest checks indicate that types.py:8 has 121 characters: But the current diff shows that types.py:8 has 20 characters: I must be misinterpreting something. |
Codecov Report
@@ Coverage Diff @@
## master #1627 +/- ##
===========================================
- Coverage 100.00% 99.89% -0.11%
===========================================
Files 21 21
Lines 3796 3845 +49
Branches 752 763 +11
===========================================
+ Hits 3796 3841 +45
- Misses 0 2 +2
- Partials 0 2 +2
Continue to review full report at Codecov.
|
not sure what was wrong with linting, it's now failing on something else. |
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.
otherwise I think looks good.
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
awesome, thank you. |
|
||
def test_constrained_set_default(): | ||
class ConSetModelMax(BaseModel): | ||
v: conset(int) = {} |
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.
This test falils on my side indicating that is not set
, but rather a dict
.
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.
Matter is failing, maybe that's why?
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.
Matter?
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.
Sorry, master.
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.
This is very weird, as per #1682 this can be fixed by setting the default to a set.
However this should still pass since we don't have validate_always=True
- the default value (an empty dict) should be okay.
The question is: what has changed on master since this was started that's causing this to fail when merged, and could that be a smoke signal to a bigger problem somewhere?
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.
validate_always is getting set to True
because of 8aebba2#diff-1ef405a6b5a2fa9f20ea7e1f92e4c38eR510 combined with https://github.com/samuelcolvin/pydantic/pull/1627/files#diff-1ef405a6b5a2fa9f20ea7e1f92e4c38eR461
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.
Yes I just saw that. I was investigating, then had to stop. I'll try to look later.
Change Summary
This adds
conset()
. The functional additions are exactly analogous to the machinery forconlist()
. The tests are also exactly analogous to those forconlist()
, with the addition of a single assertion ensuring that length checks are occurring after casting the input to a set, i.e.set([1, 1, 1, 2, 2])
satisfiedsmax_items=4
.Related issue number
#1623
Checklist
changes/<pull request or issue id>-<github username>.md
file added describing change(see changes/README.md for details)