def __init__(self, children): SearchStrategy.__init__(self) children = tuple(children) self.values = [ t for _, t in children ] self.sampler = Sampler([s for s, _ in children])
def __init__(self, function, args, kwargs): SearchStrategy.__init__(self) self.__wrapped_strategy = None self.__representation = None self.function = function self.__args = args self.__kwargs = kwargs
def __init__(self, function, args, kwargs, filters=(), *, force_repr=None): SearchStrategy.__init__(self) self.__wrapped_strategy = None self.__representation = force_repr self.function = function self.__args = args self.__kwargs = kwargs self.__filters = filters
def __init__(self, elements, min_size=0, max_size=float("inf")): SearchStrategy.__init__(self) self.min_size = min_size or 0 self.max_size = max_size if max_size is not None else float("inf") assert 0 <= self.min_size <= self.max_size self.average_size = min( max(self.min_size * 2, self.min_size + 5), 0.5 * (self.min_size + self.max_size), ) self.element_strategy = elements
def __init__(self, lower_bound, upper_bound, width): SearchStrategy.__init__(self) assert isinstance(lower_bound, float) assert isinstance(upper_bound, float) assert 0 <= lower_bound < upper_bound assert math.copysign(1, lower_bound) == 1, "lower bound may not be -0.0" assert width in (16, 32, 64) self.lower_bound = lower_bound self.upper_bound = upper_bound self.width = width
def __init__(self, allow_infinity, allow_nan, width): SearchStrategy.__init__(self) assert isinstance(allow_infinity, bool) assert isinstance(allow_nan, bool) assert width in (16, 32, 64) self.allow_infinity = allow_infinity self.allow_nan = allow_nan self.width = width self.nasty_floats = [ float_of(f, self.width) for f in NASTY_FLOATS if self.permitted(f) ] weights = [0.2 * len(self.nasty_floats)] + [0.8] * len(self.nasty_floats) self.sampler = d.Sampler(weights)
def __init__(self, machine): SearchStrategy.__init__(self) self.machine = machine self.rules = list(machine.rules()) self.enabled_rules_strategy = st.shared(FeatureStrategy(), key=("enabled rules", machine)) # The order is a bit arbitrary. Primarily we're trying to group rules # that write to the same location together, and to put rules with no # target first as they have less effect on the structure. We order from # fewer to more arguments on grounds that it will plausibly need less # data. This probably won't work especially well and we could be # smarter about it, but it's better than just doing it in definition # order. self.rules.sort(key=lambda rule: ( sorted(rule.targets), len(rule.arguments), rule.function.__name__, ))
def __init__(self, strategies): SearchStrategy.__init__(self) self.element_strategies = tuple(strategies)
def __init__(self, start, end): SearchStrategy.__init__(self) self.start = start self.end = end
def __init__(self, definition): SearchStrategy.__init__(self) self.__wrapped_strategy = None self.__in_repr = False self.__definition = definition