Skip to content

Commit

Permalink
chore: add more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
vTuanpham committed Nov 13, 2023
1 parent 7f4910f commit c6776a3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/eli5_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import os
import unittest
import warnings

from datasets import load_dataset

from examples.ELI5.ELI5_10docs_Parser import ELI5Val


Expand Down Expand Up @@ -28,6 +31,17 @@ def step4(self):
self.assertTrue(os.path.exists(self.output_path), f"File '{self.output_path}' does not exist")

def step5(self):
try:
self.translated_dataset = load_dataset("json", self.output_path, keep_in_memory=False)
except Exception as e:
raise SyntaxError("Invalid syntax for save function, the data output must be in the form of"
f"line-delimited json,\n Error message: {e}")

def step6(self):
self.assertEqual(len(self.translated_dataset['train']), len(self.parser.converted_data),
"The parsed translated dataset does not match the length of the parsed dataset")

def step7(self):
if os.path.exists(self.output_path):
os.remove(self.output_path)

Expand Down

0 comments on commit c6776a3

Please sign in to comment.