Behdad Esfahbod 03d264756b
Test var model error (#2217)
* [varLib.models] Add test for modeling rounding error

Tests https://github.com/fonttools/fonttools/pull/2214

If you flip demo to True, it does a slower test and demos the new error as well
as the error the old code was producing (ie. rounding deltas post-modeling).

Indeed, the new error is always capped by 0.5 as expected, whereas the old one
was unbounded. Here's the worst-case error of the bad code:

...
240     0.42    4.8
...

240 is just the line number. 0.42 is new error. 4.8 is old error.

* turn test_modeling_error into a parametrized pytest test

Like the other test methods in the same module, all those whose name starts with 'test_' are automatically discovered and run by pytest which is our default test runner. So there is no need to call the test method itself in the top-level module scope. One simply runs the test via pytest. To execute this specific test method one can do 'pytest Tests/varLib/models_test.py::test_modeling_error'.

* use pytest markers to mark specific test as 'slow'

So that one can optionally deselect tests marked with specific marker by passing -m option (e.g. to deselect 'slow' tests, pytest -m 'not slow' ...).

https://docs.pytest.org/en/stable/mark.html#registering-marks
https://docs.pytest.org/en/stable/example/parametrize.html#set-marks-or-test-id-for-individual-parametrized-test

* [varLib/models_test] Comment out non-test code

Co-authored-by: Cosimo Lupo <clupo@google.com>
2022-08-15 10:30:45 -06:00
..
2021-03-29 11:45:58 +02:00
2022-08-15 10:30:45 -06:00
2022-04-29 18:13:03 +01:00
2022-06-23 12:01:20 -06:00