How to use pareto_optimise method in hypothesis

Best Python code snippet using hypothesis

engine.py

Source:engine.py Github

copy

Full Screen

...674 break675 max_improvements *= 2676 if any_improvements:677 continue678 self.pareto_optimise()679 if prev_calls == self.call_count:680 break681 def pareto_optimise(self):682 if self.pareto_front is not None:683 ParetoOptimiser(self).run()684 def _run(self):685 self.reuse_existing_examples()686 self.generate_new_examples()687 # We normally run the targeting phase mixed in with the generate phase,688 # but if we've been asked to run it but not generation then we have to689 # run it explciitly on its own here.690 if Phase.generate not in self.settings.phases:691 self.optimise_targets()692 self.shrink_interesting_examples()693 self.exit_with(ExitReason.finished)694 def new_conjecture_data(self, prefix, max_length=BUFFER_SIZE, observer=None):695 return ConjectureData(...

Full Screen

Full Screen

test_pareto.py

Source:test_pareto.py Github

copy

Full Screen

...148 settings=settings(max_examples=10000, database=InMemoryExampleDatabase()),149 database_key=b"stuff",150 )151 runner.cached_test_function([255] * 20 + [0])152 runner.pareto_optimise()153 assert len(runner.pareto_front) == 6154 for i, data in enumerate(runner.pareto_front):155 assert list(data.buffer) == [1] * i + [0]156def test_does_not_optimise_the_pareto_front_if_interesting():157 def test(data):158 n = data.draw_bits(8)159 data.target_observations[""] = n160 if n == 255:161 data.mark_interesting()162 runner = ConjectureRunner(163 test,164 settings=settings(max_examples=10000, database=InMemoryExampleDatabase()),165 database_key=b"stuff",166 )167 runner.cached_test_function([0])168 runner.pareto_optimise = None169 runner.optimise_targets()170 assert runner.interesting_examples171def test_stops_optimising_once_interesting():172 hi = 2 ** 16 - 1173 def test(data):174 n = data.draw_bits(16)175 data.target_observations[""] = n176 if n < hi:177 data.mark_interesting()178 runner = ConjectureRunner(179 test,180 settings=settings(max_examples=10000, database=InMemoryExampleDatabase()),181 database_key=b"stuff",182 )183 data = runner.cached_test_function([255] * 2)184 assert data.status == Status.VALID185 runner.pareto_optimise()186 assert runner.call_count <= 20...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run hypothesis automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful