code: def test_list_count_matches() -> None:
      assert pl.DataFrame(
          {"listcol": [[], [1], [1, 2, 3, 2], [1, 2, 1], [4, 4]]}
      ).select(
          pl.col("listcol")
          .list.count_matches(2)
          .alias("number_of_twos")
      ).to_dict(
          as_series=False
      ) == {
          "number_of_twos": [0, 0, 2, 1, 0]
      }
      assert pl.DataFrame(
          {"listcol": [[], [1], [1, 2, 3, 2], [1, 2, 1], [4, 4]]}
      ).select(
          pl.col("listcol")
          .list.count_matches(2)
          .alias("number_of_twos")
      ).to_dict(
          as_series=False
      ) == {
          "number_of_twos": [0, 0, 2, 1, 0]
      }
  
imports: from __future__ import annotations
  import pickle
  from datetime import date, datetime, time
  from typing import TYPE_CHECKING, Any
  import pandas
  import pytest
  import polars
  from polars.testing import assert_frame_equal, assert_series_equal
label_desc: Use image node_id 18 for calling a global function with example usage: test_list_count_matches() without return types