code: def test_getting_started_example_with():
      train_df, test_df = helper_get_data()
  
      # with syntax calls into vw.finish() automatically.
      # you actually want to use 'with vowpalwabbit.Workspace("--cb 4") as vw:'
      # but we need to assert on vw.finished for test purposes
      vw = vowpalwabbit.Workspace("--cb 4")
      with vw as vw:
          for i in train_df.index:
              action = train_df.loc[i, "action"]
              cost = train_df.loc[i, "cost"]
              probability = train_df.loc[i, "probability"]
              feature1 = train_df.loc[i, "feature1"]
              feature2 = train_df.loc[i, "feature2"]
              feature3 = train_df.loc[i, "feature3"]
  
              learn_example = (
                  str(action)
                  + ":"
                  + str(cost)
                  + ":"
                  + str(probability)
                  + " | "
                  + str(feature1)
                  + " "
                  + str(feature2)
                  + " "
                  + str(feature3)
              )
              vw.learn(learn_example)
  
          assert (
              vw.get_prediction_type() == vw.pMULTICLASS
          ), "prediction_type should be multiclass"
  
          for j in test_df.index:
              feature1 = test_df.loc[j, "feature1"]
              feature2 = test_df.loc[j, "feature2"]
              feature3 = test_df.loc[j, "feature3"]
              choice = vw.predict(
                  "| "
                  + str(feature1)
                  + " "
                  + str(feature2)
                  + " "
                  + str(feature3)
              )
              assert isinstance(choice, int), "choice should be int"
              assert choice == 3, "predicted action should be 3"
  
      assert (
          vw.finished == True
      ), "with syntax should finish() vw instance"
  
file_path: vowpal_wabbit/python/tests/test_cb.py
imports: import pandas
  from os import path
  import vowpalwabbit
  import unittest
  import platform
  import math
  import re
label_desc: Use image node_id 9 for calling a global function with example usage: test_getting_started_example_with() without return types