Unverified Commit 6824d39d authored by Baber Abbasi's avatar Baber Abbasi Committed by GitHub
Browse files

add better testing when both doc_to_text ends in and target_delimiter are whitespaces (#2535)

parent 4a12959f
...@@ -79,11 +79,15 @@ class TestNewTasks: ...@@ -79,11 +79,15 @@ class TestNewTasks:
) )
_array = [task.doc_to_text(doc) for doc in arr] _array = [task.doc_to_text(doc) for doc in arr]
# space convention; allow txt to have length 0 for perplexity-like tasks since the model tacks an <|endoftext|> on # space convention; allow txt to have length 0 for perplexity-like tasks since the model tacks an <|endoftext|> on
target_delimiter: str = task.config.target_delimiter
if not task.multiple_input: if not task.multiple_input:
assert all( for x in _array:
isinstance(x, str) and (x[-1] != " " if len(x) != 0 else True) assert isinstance(x, str)
for x in _array assert (
) (x[-1].isspace() is False if len(x) > 0 else True)
if target_delimiter.isspace()
else True
), "doc_to_text ends in a whitespace and target delimiter also a whitespace"
else: else:
pass pass
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment