def test_check_X_negative002(self): """ If list of texts is specified as the NumPy array, then it must be a 1-D array. """ texts = np.array([[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11]]) true_err_msg = re.escape('`X` must be a 1-D array!') try: checking_method = self.assertRaisesRegex except: checking_method = self.assertRaisesRegexp with checking_method(ValueError, true_err_msg): Seq2SeqLSTM.check_X(texts, 'X')
def test_check_X_negative001(self): """ All texts must be a string and have a `split` method. """ texts = ['123', 4, '567'] true_err_msg = re.escape('Sample 1 of `X` is wrong! This sample have not the `split` method.') try: checking_method = self.assertRaisesRegex except: checking_method = self.assertRaisesRegexp with checking_method(ValueError, true_err_msg): Seq2SeqLSTM.check_X(texts, 'X')