code: def test_fit_with_class_weighting(self):
      dataset = random_transformer_dataset(10)
  
      model_args = TransformerModelArguments(
          "sshleifer/tiny-distilroberta-base"
      )
      classifier = TransformerBasedClassification(
          model_args, 2, class_weight="balanced"
      )
      with patch.object(classifier, "_fit_main") as fit_main_mock:
          classifier.fit(dataset)
          fit_main_mock.assert_called()
          self.assertIsNotNone(classifier.class_weights_)
  
imports: import unittest
  import pytest
  import numpy
  from unittest.mock import patch
  from small_text.base import LABEL_UNLABELED
  from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
  from small_text.training.early_stopping import EarlyStopping, EarlyStoppingOrCondition
  from small_text.training.metrics import Metric
  from small_text.utils.logging import VERBOSITY_MORE_VERBOSE
label_desc: Use image node_id 7 for calling the TestTransformerBasedClassification obj's underlying member method code with example usage: obj.test_fit_with_class_weighting() without return types