Conversation
TypeError may be coming from many sources, and it is not correct to assume it always comes from a non-existing attr member as the evolve codes now. Instead, we now check specifically for this case when raising a custom error, and just re-raise in other cases.
Codecov Report
@@ Coverage Diff @@
## master #182 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 8 8
Lines 551 551
Branches 122 122
=====================================
Hits 551 551
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #182 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 8 8
Lines 551 546 -5
Branches 122 121 -1
=====================================
- Hits 551 546 -5
Continue to review full report at Codecov.
|
|
One minor nitpick. In case of a non-existent attribute evolve will raise I suggest this is unnecessary. The code will be simpler, and we can avoid a confusing error message like this: |
|
|
||
| def test_validator_failure(self): | ||
| """ | ||
| Make sure we don't swallow TypeError when validation fails within |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| def test_private(self): | ||
| """ | ||
| evolve() should act as `__init__` with regards to private attributes. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| "{k} is not an attrs attribute on {cl}.".format(k=k, cl=cls)) | ||
| for name in changes: | ||
| if getattr(attrs, name, None) is None: | ||
| k = exc.args[0].split("'")[1] |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
I've only had time to glance at it (I definitely won't have time to do a full review), but I generally agree. This should probably land. |
|
Review fixes done! |
|
🎉 |
This is a continuation of #176.