code: def test_leaf_preterminal():
      foo = Tree(label="foo")
      assert foo.is_leaf()
      assert not foo.is_preterminal()
      assert len(foo.children) == 0
      assert str(foo) == "foo"
  
      bar = Tree(label="bar", children=foo)
      assert not bar.is_leaf()
      assert bar.is_preterminal()
      assert len(bar.children) == 1
      assert str(bar) == "(bar foo)"
  
      baz = Tree(label="baz", children=[bar])
      assert not baz.is_leaf()
      assert not baz.is_preterminal()
      assert len(baz.children) == 1
      assert str(baz) == "(baz (bar foo))"
  
imports: import pytest
  from stanza.models.constituency.parse_tree import Tree
  from stanza.models.constituency import tree_reader
  from stanza.tests import *
label_desc: Use image node_id 1 for calling a global function with example usage: test_leaf_preterminal() without return types