fix structure for union of attr classes with default values#108
fix structure for union of attr classes with default values#108Tinche merged 6 commits intopython-attrs:masterfrom
Conversation
|
I was trying to fix broken tests - but because I'm not familiar with a hypothesis I failed. was assuming: should fix the test - but it didn't work 😿 |
|
Hello, the test is failing because the new implementation is faulty :) This throws an error on master, but not on your branch: Just because |
|
Here's a patch that does what you want: Also please add a line to the changelog with a link back here. |
Codecov Report
@@ Coverage Diff @@
## master #108 +/- ##
==========================================
+ Coverage 97.70% 97.72% +0.02%
==========================================
Files 7 7
Lines 435 440 +5
==========================================
+ Hits 425 430 +5
Misses 10 10
Continue to review full report at Codecov.
|
|
@Tinche I think it's ready to review. (Autoreview in this case :P) |
|
@dswistowski I caught a cold, will review soon-ish :) |
|
Looks good, thanks! |
- See python-attrs/cattrs#108 for breaking PR

Structure union of attr classes when one of the fields was optional and had a default value was not deterministic.
Disambiguator function sometimes was created to use field with default value - and because it's allowed to not provide this value to
__init__method wrong class was chosen to structure.A provided test case is a minimal deterministic test I was able to generate.