@composite
def application_strategy(draw, min_number_of_ports=0, stateful=False):
 num_ports = draw(st.integers(min_value=min_number_of_ports, max_value=max(8, (min_number_of_ports + 1))))
 dataset_id = unicode(uuid4())
 application = Application(name=draw(unique_name_strategy()), image=draw(docker_image_strategy()), ports=frozenset((Port(internal_port=(8000 + i), external_port=((8000 + i) + 1)) for i in xrange(num_ports))))
 if stateful:
  application = application.set('volume', AttachedVolume(manifestation=Manifestation(dataset=Dataset(dataset_id=dataset_id, deleted=False), primary=True), mountpoint=FilePath('/flocker').child(dataset_id)))
 return application

@ composite def application_strategy ( draw , min_number_of_ports = 0 , stateful = False ) : num_ports = draw ( st . integers ( min_value = min_number_of_ports , max_value = max ( 8 , ( min_number_of_ports + 1 ) ) ) ) dataset_id = unicode ( uuid4 ( ) ) application = Application ( name = draw ( unique_name_strategy ( ) ) , image = draw ( docker_image_strategy ( ) ) , ports = frozenset ( ( Port ( internal_port = ( 8000 + i ) , external_port = ( ( 8000 + i ) + 1 ) ) for i in xrange ( num_ports ) ) ) ) if stateful : application = application . set ( 'volume' , AttachedVolume ( manifestation = Manifestation ( dataset = Dataset ( dataset_id = dataset_id , deleted = False ) , primary = True ) , mountpoint = FilePath ( '/flocker' ) . child ( dataset_id ) ) ) return application
a hypothesis strategy to generate an application .