At last: aunit test for mode files

8 views
Skip to first unread message

Edward K. Ream

unread,
Nov 18, 2024, 11:17:07 AM11/18/24
to leo-editor

PRs #4190 and #4192 are now part of devel. These PRs are a significant milestone in Leo's history. For the first time, a unit test proves that all mode files will execute without raising an exception. The unit test found real problems in several mode files. Each PR fixed some of those problems.


In retrospect, creating such a unit test was blindingly obvious. But considerable preliminary work came first.


The breakthrough came from re-reading PEP #3102: Keyword-only Arguments. Aha! Python will raise a TypeError if a call does not match the function's definition. Static checkers like pylint and mypy will not suffice.


After this Aha, the unit test was surprisingly easy to write, as you can see for yourself.


Edward


P.S. As noted in the second PR, somebody added defective rules to two mode files. Apparently nobody noticed. I certainly don't care :-)


Edward

Reply all
Reply to author
Forward
0 new messages