<s> import gevent <EOL> from django . utils . unittest import TestCase <EOL> from . models import TestModel <EOL> from django_db_geventpool . utils import close_connection <EOL> @ close_connection <EOL> def test_multiple_connections ( count ) : <EOL> print '<STR_LIT>' . format ( count ) <EOL> for x in range ( <NUM_LIT:0> , <NUM_LIT:20> ) : <EOL> assert len ( TestModel . objects . all ( ) ) == <NUM_LIT:1> <EOL> print '<STR_LIT>' . format ( count ) <EOL> class ModelTest ( TestCase ) : <EOL> def test_model_save ( self ) : <EOL> data = '<STR_LIT>' <EOL> obj = TestModel . objects . create ( data = data ) <EOL> obj2 = TestModel . objects . get ( pk = obj . pk ) <EOL> self . assertEqual ( obj . data , obj2 . data ) <EOL> def test_connections ( self ) : <EOL> TestModel . objects . create ( data = '<STR_LIT:test>' ) <EOL> greenlets = [ ] <EOL> for x in range ( <NUM_LIT:0> , <NUM_LIT:50> ) : <EOL> greenlets . append ( gevent . spawn ( test_multiple_connections , x ) ) <EOL> gevent . joinall ( greenlets ) </s>
