construct-typing icon indicating copy to clipboard operation
construct-typing copied to clipboard

Testing compiled classes?

Open arekbulski opened this issue 4 years ago • 5 comments

Does your project run tests against compiled classes as well? If you look, I added a new testing function called common2(). It checks compiled classes against core ones.

arekbulski avatar Mar 30 '21 18:03 arekbulski

No, I honestly forgot to transfer your adjustments to your tests into this repo. But the compiled feature is not that important for me anyway, since I don't care so much about performance. Good type hints are much more important to me. If I have some more time, I might take a closer look at it, but currently I'm still very busy creating a GUI for construct 😉

timrid avatar Mar 30 '21 18:03 timrid

There is a specific reason why I ask. I had a defect in a new class, ZigZag. Sometimes it returned floats instead of integers. If python was statically typed, it would probably have been caught right and there.

arekbulski avatar Mar 30 '21 18:03 arekbulski

Was the defect insider the class or was it in the tests? Because I dont have included typ hints for the internals, just for that what the user normally uses. So I am not quiet sure if your defect would be caught, if it is inside the class.

timrid avatar Mar 30 '21 19:03 timrid

Here is the fix commit: https://github.com/construct/construct/commit/4fce921815b37975e585a652a334ccf98063c53a

arekbulski avatar Mar 30 '21 19:03 arekbulski

No, this would not have been caught with the type hints. In the type hint I assume that the correct types are returned by the construct. But I dont perform checks at runtime.

timrid avatar Mar 30 '21 19:03 timrid