MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / test_pool_min_size_validation

Method test_pool_min_size_validation

tests/test_pool.py:1184–1208  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1182 self.assertIs(pool._holders[1]._con, None)
1183
1184 async def test_pool_min_size_validation(self):
1185 # init_size < min_size should raise.
1186 with self.assertRaisesRegex(ValueError,
1187 'init_size is smaller than min_size'):
1188 await self.create_pool(
1189 database='postgres', init_size=1, min_size=2, max_size=5)
1190
1191 # min_size > max_size should raise.
1192 with self.assertRaisesRegex(ValueError,
1193 'min_size is greater than max_size'):
1194 await self.create_pool(
1195 database='postgres', init_size=3, min_size=3, max_size=2)
1196
1197 # init_size > max_size should raise.
1198 with self.assertRaisesRegex(ValueError,
1199 'init_size is greater than max_size'):
1200 await self.create_pool(
1201 database='postgres', init_size=5, min_size=1, max_size=3)
1202
1203 # init_size < 0 should raise.
1204 with self.assertRaisesRegex(
1205 ValueError,
1206 'init_size is expected to be greater or equal to zero'):
1207 await self.create_pool(
1208 database='postgres', init_size=-1, min_size=0, max_size=3)
1209
1210 async def test_pool_init_size_and_min_size_getters(self):
1211 async with self.create_pool(

Callers

nothing calls this directly

Calls 1

create_poolMethod · 0.45

Tested by

no test coverage detected