Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_raises_value_error_with_invalid_split(self):
with self.assertRaises(ValueError):
CnnDailymail(split='invalid_split')
def test_loads_each_split(self):
train = CnnDailymail(split='train')
self.assertEqual(len(train), 287_227)
dev = CnnDailymail(split='dev')
self.assertEqual(len(dev), 13_368)
test = CnnDailymail(split='test')
self.assertEqual(len(test), 11_490)
def test_loads_each_split(self):
train = CnnDailymail(split='train')
self.assertEqual(len(train), 287_227)
dev = CnnDailymail(split='dev')
self.assertEqual(len(dev), 13_368)
test = CnnDailymail(split='test')
self.assertEqual(len(test), 11_490)
def test_loads_each_split(self):
train = CnnDailymail(split='train')
self.assertEqual(len(train), 287_227)
dev = CnnDailymail(split='dev')
self.assertEqual(len(dev), 13_368)
test = CnnDailymail(split='test')
self.assertEqual(len(test), 11_490)
def __init__(self, split: str = 'train') -> None:
if split not in {'train', 'dev', 'test'}:
raise ValueError(f"only 'train', 'dev' and 'test' are valid for 'split', but '{split}' is given.")
raw = cached_get_cnn_dailymail()
super(CnnDailymail, self).__init__(*raw[split])