Example #1
0
    'skeleton_key':
    skeleton.fingerprint,
    'omission_key':
    omission.fingerprint,
    'occurrence_fingerprint':
    occurrence.fingerprint,
    'occurrence_halved_fingerprint':
    occurrence_halved.fingerprint,
    'count_fingerprint':
    count.fingerprint,
    'position_fingerprint':
    position.fingerprint,
    'synoname_toolcode':
    synoname.fingerprint,
    'synoname_toolcode_2name':
    lambda _: synoname.fingerprint(_, _),
}


class BigListOfNaughtyStringsTestCases(unittest.TestCase):
    """Test each fingerprint algorithm against the BLNS set.

    Here, we test each algorithm against each string, but we only care that it
    does not result in an exception.

    While not actually a fuzz test, this does serve the purpose of looking for
    errors resulting from unanticipated input.
    """
    def test_blns(self):
        """Test each fingerprint algorithm against the BLNS set."""
        blns = []
Example #2
0
    'extract_position_frequency': ExtractPositionFrequency().fingerprint,
    'lacss': LACSS().fingerprint,
    'lc_cutter': LCCutter().fingerprint,
    'occurrence': Occurrence().fingerprint,
    'occurrence_halved': OccurrenceHalved().fingerprint,
    'omission_key': OmissionKey().fingerprint,
    'phonetic': Phonetic().fingerprint,
    'position': Position().fingerprint,
    'position_32_2': Position(n_bits=32, bits_per_letter=2).fingerprint,
    'qgram': QGram().fingerprint,
    'qgram_q3': QGram(qval=3).fingerprint,
    'qgram_ssj': QGram(start_stop='$#', joiner=' ').fingerprint,
    'skeleton_key': SkeletonKey().fingerprint,
    'string': String().fingerprint,
    'synoname_toolcode': synoname.fingerprint,
    'synoname_toolcode_2name': lambda _: synoname.fingerprint(_, _),
}


class BigListOfNaughtyStringsTestCases(unittest.TestCase):
    """Test each fingerprint algorithm against the BLNS set.

    Here, we test each algorithm against each string, but we only care that it
    does not result in an exception.

    While not actually a fuzz test, this does serve the purpose of looking for
    errors resulting from unanticipated input.
    """
    def fuzz_test_blns(self):
        """Test each fingerprint algorithm against the BLNS set."""
        blns = []
Example #3
0
synoname = SynonameToolcode()

algorithms = {
    'str_fingerprint': String().fingerprint,
    'qgram_fingerprint': QGram().fingerprint,
    'qgram_fingerprint_3': QGram(qval=3).fingerprint,
    'qgram_fingerprint_ssj': QGram(start_stop='$#', joiner=' ').fingerprint,
    'phonetic_fingerprint': Phonetic().fingerprint,
    'skeleton_key': SkeletonKey().fingerprint,
    'omission_key': OmissionKey().fingerprint,
    'occurrence_fingerprint': Occurrence().fingerprint,
    'occurrence_halved_fingerprint': OccurrenceHalved().fingerprint,
    'count_fingerprint': Count().fingerprint,
    'position_fingerprint': Position().fingerprint,
    'synoname_toolcode': synoname.fingerprint,
    'synoname_toolcode_2name': lambda _: synoname.fingerprint(_, _),
}


class BigListOfNaughtyStringsTestCases(unittest.TestCase):
    """Test each fingerprint algorithm against the BLNS set.

    Here, we test each algorithm against each string, but we only care that it
    does not result in an exception.

    While not actually a fuzz test, this does serve the purpose of looking for
    errors resulting from unanticipated input.
    """

    def test_blns(self):
        """Test each fingerprint algorithm against the BLNS set."""