code: def test_construct_tree():
      # Input a complete tree and check for each node the children and parents
      hash_dict, dist_func = initialize_for_bktree()
      bk = BKTree(hash_dict, dist_func)
      # check root
      assert bk.ROOT == "a"
      # check that expected leaf nodes have no children (they're actually leaf nodes)
      leaf_nodes = set(
          [
              k
              for k in bk.dict_all.keys()
              if len(bk.dict_all[k].children) == 0
          ]
      )
      expected_leaf_nodes = set(["b", "d", "f", "h"])
      assert leaf_nodes == expected_leaf_nodes
      # check that root node ('a') has 4 children
      assert len(bk.dict_all[bk.ROOT].children) == 4
      # check that 'c' has 'd' as it's child at distance 2
      assert bk.dict_all["c"].children["d"] == 2
  
file_path: imagededup/tests/test_bktree.py
imports: from collections import OrderedDict
  from imagededup.methods.hashing import Hashing
  from imagededup.handlers.search.bktree import BKTree, BkTreeNode
label_desc: Use image node_id 7 for calling a global function with example usage: test_construct_tree() without return types