def comment_has_units(self, comment): logger.debug('comment_has_units(comment={!r})'.format(comment.id)) return any(Unit.find_units(comment.body))
def test_text_detection(text, expected_units): """Make sure we detect all mentioned units anywhere in a text.""" found_units = list(Unit.find_units(text)) assert found_units == expected_units