def test_too_much_parsing(self): def energy_factory(): return Energy(5) transformer = SearchTransformer(tokenize, Parser, optimize_tree, energy_factory) bad_query = 10 * "happy " result = transformer.transform(bad_query) self.assertEqual(bad_query, result)
def test_internal_error(self): @token_peekable def blow_up(stream): raise Exception yield None def energy_factory(): return Energy(5000) transformer = SearchTransformer(blow_up, Parser, optimize_tree, energy_factory) result = transformer.transform("error here ok") self.assertEqual("error here ok", result)