How to use _draw_core_dimensions method in hypothesis

Best Python code snippet using hypothesis

numpy.py

Source:numpy.py Github

copy

Full Screen

...710 # We don't usually have a gufunc signature; do the common case first & fast.711 if self.signature is None:712 return self._draw_loop_dimensions(data)713 # When we *do*, draw the core dims, then draw loop dims, and finally combine.714 core_in, core_res = self._draw_core_dimensions(data)715 # If some core shape has omitted optional dimensions, it's an error to add716 # loop dimensions to it. We never omit core dims if min_dims >= 1.717 # This ensures that we respect Numpy's gufunc broadcasting semantics and user718 # constraints without needing to check whether the loop dims will be719 # interpreted as an invalid substitute for the omitted core dims.720 # We may implement this check later!721 use = [None not in shp for shp in core_in]722 loop_in, loop_res = self._draw_loop_dimensions(data, use=use)723 def add_shape(loop, core):724 return tuple(x for x in (loop + core)[-32:] if x is not None)725 return BroadcastableShapes(726 input_shapes=tuple(add_shape(l, c) for l, c in zip(loop_in, core_in)),727 result_shape=add_shape(loop_res, core_res),728 )729 def _draw_core_dimensions(self, data):730 # Draw gufunc core dimensions, with None standing for optional dimensions731 # that will not be present in the final shape. We track omitted dims so732 # that we can do an accurate per-shape length cap.733 dims = {}734 shapes = []735 for shape in self.signature.input_shapes + (self.signature.result_shape,):736 shapes.append([])737 for name in shape:738 if name.isdigit():739 shapes[-1].append(int(name))740 continue741 if name not in dims:742 dim = name.strip("?")743 dims[dim] = data.draw(self.side_strat)...

Full Screen

Full Screen

_array_helpers.py

Source:_array_helpers.py Github

copy

Full Screen

...431 # We don't usually have a gufunc signature; do the common case first & fast.432 if self.signature is None:433 return self._draw_loop_dimensions(data)434 # When we *do*, draw the core dims, then draw loop dims, and finally combine.435 core_in, core_res = self._draw_core_dimensions(data)436 # If some core shape has omitted optional dimensions, it's an error to add437 # loop dimensions to it. We never omit core dims if min_dims >= 1.438 # This ensures that we respect Numpy's gufunc broadcasting semantics and user439 # constraints without needing to check whether the loop dims will be440 # interpreted as an invalid substitute for the omitted core dims.441 # We may implement this check later!442 use = [None not in shp for shp in core_in]443 loop_in, loop_res = self._draw_loop_dimensions(data, use=use)444 def add_shape(loop, core):445 return tuple(x for x in (loop + core)[-NDIM_MAX:] if x is not None)446 return BroadcastableShapes(447 input_shapes=tuple(add_shape(l_in, c) for l_in, c in zip(loop_in, core_in)),448 result_shape=add_shape(loop_res, core_res),449 )450 def _draw_core_dimensions(self, data):451 # Draw gufunc core dimensions, with None standing for optional dimensions452 # that will not be present in the final shape. We track omitted dims so453 # that we can do an accurate per-shape length cap.454 dims = {}455 shapes = []456 for shape in self.signature.input_shapes + (self.signature.result_shape,):457 shapes.append([])458 for name in shape:459 if name.isdigit():460 shapes[-1].append(int(name))461 continue462 if name not in dims:463 dim = name.strip("?")464 dims[dim] = data.draw(self.side_strat)...

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