def test_grow_expands_resource_pool_when_requested_size_greater_than_current_size(self): p = Pool(WidgetFactory()) p.grow(3) self.assertEquals(3, p.size()) self.assertEquals(3, p.available()) for i in range(5): p.checkout() p.grow(10) self.assertEquals(10, p.size()) self.assertEquals(10-5, p.available())
def test_grow_does_nothing_when_requested_size_less_than_or_equal_to_current_size(self): p = Pool(WidgetFactory()) for i in range(10): p.checkout() p.grow(5) self.assertEquals(10, p.size()) self.assertEquals(0, p.available()) p.grow(10) self.assertEquals(10, p.size()) self.assertEquals(0, p.available())
def test_grow_expands_resource_pool_when_requested_size_greater_than_current_size( self): p = Pool(WidgetFactory()) p.grow(3) self.assertEquals(3, p.size()) self.assertEquals(3, p.available()) for i in range(5): p.checkout() p.grow(10) self.assertEquals(10, p.size()) self.assertEquals(10 - 5, p.available())
def test_grow_does_nothing_when_requested_size_less_than_or_equal_to_current_size( self): p = Pool(WidgetFactory()) for i in range(10): p.checkout() p.grow(5) self.assertEquals(10, p.size()) self.assertEquals(0, p.available()) p.grow(10) self.assertEquals(10, p.size()) self.assertEquals(0, p.available())
def test_grow_shrink_combos(self): p = Pool(WidgetFactory()) p.grow(5) p.shrink() p.grow(20) p.checkout() p.shrink() p.checkout() p.grow(3) self.assertEquals(3, p.size()) self.assertEquals(1, p.available())