code: def test_count_exprs():
      assert (
          ast.count_exprs(
              ast.BinNumExpr(
                  ast.NumVal(1), ast.NumVal(2), ast.BinNumOpType.ADD
              )
          )
          == 3
      )
  
      assert ast.count_exprs(ast.ExpExpr(ast.NumVal(2))) == 2
  
      assert (
          ast.count_exprs(
              ast.VectorVal(
                  [ast.NumVal(2), ast.TanhExpr(ast.NumVal(3))]
              )
          )
          == 4
      )
  
      assert (
          ast.count_exprs(
              ast.IfExpr(
                  ast.CompExpr(
                      ast.NumVal(2), ast.NumVal(0), ast.CompOpType.GT
                  ),
                  ast.NumVal(3),
                  ast.NumVal(4),
              )
          )
          == 6
      )
  
      assert ast.count_exprs(ast.NumVal(1)) == 1
  
      with pytest.raises(
          ValueError, match="Unexpected expression type 'VectorExpr'"
      ):
          ast.count_exprs(ast.VectorExpr())
  
file_path: m2cgen/tests/test_ast.py
imports: from copy import deepcopy
  import numpy
  import pytest
  from m2cgen import ast
label_desc: Use image node_id 1 for calling a global function with example usage: test_count_exprs() without return types