Conformance: align dataclass descriptor tests with runtime#2299
Conformance: align dataclass descriptor tests with runtime#2299ashishpatel26 wants to merge 1 commit into
Conversation
|
What - in your opinion - would be the proper solution for these cases? I generally want to avoid removing tests and rather expand the docs or correct the tests. There are a lot of cases where the spec is lacking and I want to avoid removing them all. In my opinion it is very valuable to standardize descriptors on Dataclasses. I'm not particularly invested in how they are standardized, but I would like to have that to be one specific way. |
|
As I wrote in the issue, pyrefly's behavior seemed the most correct to me. I'm not sure this behavior needs to be specified in the typing spec in much detail since what I view as the correct behavior primarily reflects the runtime. |
I agree that this does not necessarily need to be specified. However I would still prefer to make the pyrefly behavior part of the tests than to drop the test. |
c6b7cd9 to
d49e4a1
Compare
|
Thanks both. I reworked this to keep the non-data descriptor coverage rather than deleting it, and aligned the
I regenerated the result files and summary HTML for this test. With the runtime-correct asserts, all six checker result TOMLs are now scored |
Closes #2259.
dataclasses_descriptors.pykeeps coverage for the non-data descriptor (Desc2, only__get__) used as a dataclass field, but aligns the expected behavior with runtime descriptor lookup:DC2.x/DC2.yclass access is optional-error because those fields have no descriptor object in the class namespace.DC2.zclass access islist[str], because class access invokesDesc2.__get__(None, owner).dc2.x/dc2.y/dc2.zare the storedDesc2[...]objects, because non-data descriptors are shadowed by the instance__dict__after dataclass__init__assigns the fields.The result TOMLs and summary HTML have been regenerated. With the runtime-correct asserts, all six checkers are scored
Partialfordataclasses_descriptors.