class_docstr: Base class for testing frequent pattern mining on a small example.
class_docstr_tok: ["Base","class","for","testing","frequent","pattern","mining","on","a","small","example","."]
code: def test_sparse(self):
      def test_with_fill_values(fill_value):
          sdt = pd.SparseDtype(type(fill_value), fill_value=fill_value)
          sdf = self.df.astype(sdt)
          res_df = self.fpalgo(sdf, use_colnames=True)
          assert (
              res_df.values.shape == self.fpalgo(self.df).values.shape
          )
          assert res_df[
              res_df["itemsets"] == "nothing"
          ].values.shape == (0, 2)
          assert res_df[
              res_df["itemsets"] == {"Milk", "Kidney Beans"}
          ].values.shape == (1, 2)
          assert res_df[
              res_df["itemsets"] == frozenset(("Milk", "Kidney Beans"))
          ].values.shape == (1, 2)
          assert res_df[
              res_df["itemsets"] == frozenset(("Kidney Beans", "Milk"))
          ].values.shape == (1, 2)
  
      test_with_fill_values(0)
      test_with_fill_values(False)
  
imports: import sys
  from contextlib import contextmanager
  from io import StringIO
  import numpy
  import pandas
  from numpy.testing import assert_array_equal
  from packaging.version import Version
  from pandas import __version__
  from scipy.sparse import csr_matrix
  from mlxtend.preprocessing import TransactionEncoder
  from mlxtend.utils import assert_raises
label_desc: Use image node_id 3 for calling the FPTestEx1 obj's underlying member method code with example usage: obj.test_sparse() without return types