added empty subsequence test to subs-only hnm_byteslike

This commit is contained in:
Tal Einat 2014-05-11 02:35:28 +03:00
parent f71d362807
commit f48e3e7154
2 changed files with 6 additions and 3 deletions

View File

@ -27,6 +27,11 @@ substitutions_only_has_near_matches_byteslike(PyObject *self, PyObject *args)
Py_RETURN_FALSE;
}
if (subseq_len == 0) {
PyErr_SetString(PyExc_ValueError, "Given subsequence is empty!");
return NULL;
}
sub_counts = (unsigned int *) malloc (sizeof(unsigned int) * subseq_len);
if (sub_counts == NULL) {
return PyErr_NoMemory();

View File

@ -302,12 +302,10 @@ try:
except ImportError:
pass
else:
class TestFindNearMatchesSubstitionsByteslike(
class TestHasNearMatchesSubstitionsByteslike(
TestHasNearMatchSubstitionsOnlyBase,
unittest.TestCase
):
def search(self, subsequence, sequence, max_subs):
return hnm_subs_byteslike(subsequence, sequence, max_subs)
def test_empty_subsequence_exeption(self):
pass