hypothesmith
hypothesmith copied to clipboard
FailedHealthCheck when generating eval_input
When generating eval input I consistently get the following error:
hypothesis.errors.FailedHealthCheck: It looks like your strategy is filtering out a lot of data. Health check found 50 filtered examples but only 3 good ones. This will make your tests much slower, and also will probably distort the data generation quite a lot. You should adapt your strategy to filter less. This can also be caused by a low max_leaves parameter in recursive() calls
See https://hypothesis.readthedocs.io/en/latest/healthchecks.html for more information about this. If you want to disable just this health check, add HealthCheck.filter_too_much to the suppress_health_check settings for this test.
The test is really straightforward:
@hypothesis.given(hypothesmith.from_grammar(start="eval_input"))
def test_expressions(self, expression: str):
expression = expression.strip()
print(expression)
self.assertTrue(expression)
Note: the error appears in subsequent runs. The first time I get no error but is quite slow, but whenever I re-run the tests the errors is triggered and the tests are run much faster.