lucidrains / vector-quantize-pytorch

Vector (and Scalar) Quantization, in Pytorch
MIT License
2.44k stars 197 forks source link

Add a simple test suite #125

Closed MisterBourbaki closed 4 months ago

MisterBourbaki commented 4 months ago

The proposition is simple: use the pytest plugin pytest-examples to efficiently test all examples writtent in the README. This enforces simple tests of the package, in particular thanks to the dedicated GitHub workflow.

There is no modification of the code itself! This PR is only for providing a first, simple test suite.

MisterBourbaki commented 4 months ago

Nota Bene: this is thanks to thoses tests that I uncovered the issue #123 😄

lucidrains commented 4 months ago

@MisterBourbaki i never knew about this! this is exactly how i wanted things

you read my mind; thank you

MisterBourbaki commented 4 months ago

You are very welcome :)

I have a few other ideas to help improve the code... I will try to implement those, step by step ;) This is really a great project, thanks for your hard work!

lucidrains commented 4 months ago

@MisterBourbaki sounds good, i may push back on some, but pytest_examples is really nice with no downsides; will def start converting some other repos to this type of integration testing

MisterBourbaki commented 4 months ago

@lucidrains pytest-examples is really a good plugin for pytest. Made by Samuel Colvin, who always does impressive job!

What would you think about lint and format of the code? It will be quite a lot of work, but if you want I can work on that.

lucidrains commented 4 months ago

@MisterBourbaki yea, Samuel is legendary!

ruff is fine with me!

lucidrains commented 4 months ago

hmm, pytest-examples seems kind of limited still

maybe i'll have to contribute a few more functionalities to it

MisterBourbaki commented 4 months ago

hmm, pytest-examples seems kind of limited still

maybe i'll have to contribute a few more functionalities to it

For sure it is. It aims only at running and checking the examples in documentations. Have you run into some issues with it? or are you thining about more tests, more complex?