Пример #1
0
 def __init__(self,
              strategies,
              descriptor,
              **kwargs):
     SearchStrategy.__init__(self, strategies, descriptor, **kwargs)
     self.mapped_strategy = strategies.strategy(
         descriptor.hypothesis_test_requirements
     )
Пример #2
0
 def __init__(self, shape, min_dims, max_dims, allow_ellipsis, allow_newaxis):
     assert 0 <= min_dims <= max_dims <= 32
     SearchStrategy.__init__(self)
     self.shape = shape
     self.min_dims = min_dims
     self.max_dims = max_dims
     self.allow_ellipsis = allow_ellipsis
     self.allow_newaxis = allow_newaxis
Пример #3
0
 def __init__(self, strategies, descriptor, **kwargs):
     SearchStrategy.__init__(self, strategies, descriptor, **kwargs)
     step_strategies = [
         StepStrategy(strategies, s) for s in descriptor.test_steps()
     ]
     child_mapper = strategies.new_child_mapper()
     child_mapper.define_specification_for(
         Step, lambda sgs, _: sgs.strategy(one_of(step_strategies)))
     self.mapped_strategy = child_mapper.strategy([Step])
Пример #4
0
 def __init__(self, shape, min_dims, max_dims, min_side, max_side):
     assert 0 <= min_side <= max_side
     assert 0 <= min_dims <= max_dims <= 32
     SearchStrategy.__init__(self)
     self.shape = shape
     self.side_strat = st.integers(min_side, max_side)
     self.min_dims = min_dims
     self.max_dims = max_dims
     self.min_side = min_side
     self.max_side = max_side
Пример #5
0
 def __init__(self,
              strategies,
              descriptor,
              **kwargs):
     SearchStrategy.__init__(self, strategies, descriptor, **kwargs)
     step_strategies = [
         StepStrategy(strategies, s)
         for s in descriptor.test_steps()
     ]
     child_mapper = strategies.new_child_mapper()
     child_mapper.define_specification_for(
         Step,
         lambda sgs, _: sgs.strategy(one_of(step_strategies))
     )
     self.mapped_strategy = child_mapper.strategy([Step])
Пример #6
0
    def __init__(
        self,
        num_shapes,
        base_shape=(),
        min_dims=0,
        max_dims=None,
        min_side=1,
        max_side=None,
    ):
        assert 0 <= min_side <= max_side
        assert 0 <= min_dims <= max_dims <= 32
        SearchStrategy.__init__(self)
        self.base_shape = base_shape
        self.side_strat = st.integers(min_side, max_side)
        self.num_shapes = num_shapes
        self.min_dims = min_dims
        self.max_dims = max_dims
        self.min_side = min_side
        self.max_side = max_side

        self.size_one_allowed = self.min_side <= 1 <= self.max_side
Пример #7
0
 def __init__(self,strategies,descriptor):
     SearchStrategy.__init__(self,strategies,descriptor)
     self.int_strategy = strategies.strategy(int)
Пример #8
0
 def __init__(   self,
                 strategies,
                 descriptor,
                 **kwargs):
     SearchStrategy.__init__(self, strategies, descriptor,**kwargs)
     self.mapped_strategy = strategies.strategy(one_of([Leaf, Split]))
Пример #9
0
 def __init__(   self,
                 strategies,
                 descriptor,
                 **kwargs):
     SearchStrategy.__init__(self, strategies, descriptor,**kwargs)
     self.mapped_strategy = strategies.strategy((BinaryTree, BinaryTree))
Пример #10
0
 def __init__(   self,
                 strategies,
                 descriptor,
                 **kwargs):
     SearchStrategy.__init__(self, strategies, descriptor,**kwargs)
     self.mapped_strategy = strategies.strategy(int)
Пример #11
0
 def __init__(self, strategies, descriptor, **kwargs):
     SearchStrategy.__init__(self, strategies, descriptor, **kwargs)
     self.mapped_strategy = strategies.strategy((BinaryTree, BinaryTree))
Пример #12
0
 def __init__(self, strategies, descriptor, **kwargs):
     SearchStrategy.__init__(self, strategies, descriptor, **kwargs)
     self.mapped_strategy = strategies.strategy(int)
Пример #13
0
 def __init__(self, elements, size):
     SearchStrategy.__init__(self)
     self.__length = st.integers(0, ceil(size**0.5))
     self.__elements = elements
Пример #14
0
 def __init__(self, strategies, descriptor, **kwargs):
     SearchStrategy.__init__(self, strategies, descriptor, **kwargs)
     self.mapped_strategy = strategies.strategy(one_of([Leaf, Split]))
 def __init__(self, p):
     SearchStrategy.__init__(self)
     self.__p = p
Пример #16
0
 def __init__(self, strategies, descriptor):
     SearchStrategy.__init__(self, strategies, descriptor)
     self.int_strategy = strategies.strategy(int)
 def __init__(self, elements, size):
     SearchStrategy.__init__(self)
     self.__length = st.integers(0, ceil(size ** 0.5))
     self.__elements = elements
 def __init__(self, poison_chance):
     SearchStrategy.__init__(self)
     self.__poison_chance = poison_chance
     self.__ints = st.integers(0, 10)
Пример #19
0
 def __init__(self, strategies, descriptor, **kwargs):
     SearchStrategy.__init__(self, strategies, descriptor, **kwargs)
     self.mapped_strategy = strategies.strategy(
         descriptor.hypothesis_test_requirements)
Пример #20
0
 def __init__(   self,
                 strategies,
                 descriptor,
                 **kwargs):
     SearchStrategy.__init__(self, strategies, descriptor,**kwargs)
     self.mapped_strategy = strategies.strategy([HeavilyBranchingTree])
Пример #21
0
 def __init__(self, poison_chance):
     SearchStrategy.__init__(self)
     self.__poison_chance = poison_chance
     self.__ints = st.integers(0, 10)
Пример #22
0
def hypothesis_parametrize(argspec: Union[Tuple[str], str], strategy: SearchStrategy, max_examples=10):
    return pytest.mark.parametrize(argspec, (strategy.example() for i in range(max_examples)))
 def __init__(self, p):
     SearchStrategy.__init__(self)
     self.__p = p
Пример #24
0
 def __init__(self, strategies, descriptor, **kwargs):
     SearchStrategy.__init__(self, strategies, descriptor, **kwargs)
     self.mapped_strategy = strategies.strategy([HeavilyBranchingTree])