class_docstr: Test class for metrics tests.
class_docstr_tok: ["Test","class","for","metrics","tests","."]
code: def test_invalid_weighted_kappa(self):
      with self.assertRaises(ValueError):
          kappa(
              [1, 2, 1],
              [1, 2, 1],
              weights="invalid",
              allow_off_by_one=False,
          )
      with self.assertRaises(ValueError):
          kappa(
              [1, 2, 1],
              [1, 2, 1],
              weights="invalid",
              allow_off_by_one=True,
          )
  
file_path: skll/tests/test_metrics.py
imports: import unittest
  from pathlib import Path
  from numpy.testing import assert_almost_equal
  from sklearn.metrics import fbeta_score
  from skll.metrics import kappa, use_score_func
  from skll.utils.testing import output_dir, test_dir, train_dir
label_desc: Use image node_id 7 for calling the TestMetrics obj's underlying member method code with example usage: obj.test_invalid_weighted_kappa() without return types