Recent Commits to lark:master

  • 30/07/2026 9:36

    Fix Template.search() dropping zero-variable matches

    Fix Template.search() dropping zero-variable matches
    
    Template.match() returns an empty dict when a template with no variable
    placeholders matches a subtree, and None when there is no match. search()
    tested the result for truthiness, so the empty dict was treated as "no
    match" and every zero-variable match was silently dropped. translate()
    therefore never replaced anything for such templates.
    
    search() now tests `res is not None`, matching the contract match()
    documents.
    
    Two existing search tests asserted the broken behaviour and are corrected;
    added a test that a genuinely different tree still yields nothing, and a
    TemplateTranslator test covering a variable-free translation.
    
    Closes #1630

Log in