nbansal commited on
Commit
536d81c
1 Parent(s): d05159f
Files changed (2) hide show
  1. tests.py +2 -2
  2. utils.py +2 -1
tests.py CHANGED
@@ -343,7 +343,7 @@ class TestSemF1(unittest.TestCase):
343
 
344
  def test_none_input(self):
345
  def _call_metric(preds, refs, tok, mul_ref):
346
- with self.assertRaises(ValueError) as ctx:
347
  _ = self.semf1_metric.compute(
348
  predictions=preds,
349
  references=refs,
@@ -354,7 +354,7 @@ class TestSemF1(unittest.TestCase):
354
  verbose=False,
355
  model_type="use",
356
  )
357
- print(f"Raised ValueError with message: {ctx.exception}")
358
  return ""
359
 
360
  # # Case 1: tokenize_sentences = True, multi_references = True
 
343
 
344
  def test_none_input(self):
345
  def _call_metric(preds, refs, tok, mul_ref):
346
+ with self.assertRaises(Exception) as ctx:
347
  _ = self.semf1_metric.compute(
348
  predictions=preds,
349
  references=refs,
 
354
  verbose=False,
355
  model_type="use",
356
  )
357
+ print(f"Raised Exception with message: {ctx.exception}")
358
  return ""
359
 
360
  # # Case 1: tokenize_sentences = True, multi_references = True
utils.py CHANGED
@@ -201,7 +201,8 @@ def is_nested_list_of_type(lst_obj, element_type, depth: int) -> Tuple[bool, str
201
  for i, item in enumerate(lst_o):
202
  is_valid, err = _is_nested_list_of_type(item, e_type, d - 1)
203
  if not is_valid:
204
- msg = f"Element at index {i} has incorrect type.\n{err}" if d == orig_depth else err
 
205
  return False, msg
206
  return True, ""
207
  else:
 
201
  for i, item in enumerate(lst_o):
202
  is_valid, err = _is_nested_list_of_type(item, e_type, d - 1)
203
  if not is_valid:
204
+ msg = (f"Element at index {i} has incorrect type.\nGiven Element at index {i}: {lst_o[i]}"
205
+ f"\n{err}") if d == orig_depth else err
206
  return False, msg
207
  return True, ""
208
  else: