<s> from asyncflux import AsyncfluxClient <EOL> from asyncflux . database import Database <EOL> from asyncflux . shardspace import ShardSpace <EOL> from asyncflux . testing import AsyncfluxTestCase , gen_test <EOL> class ShardSpaceTestCase ( AsyncfluxTestCase ) : <EOL> def test_class_instantiation ( self ) : <EOL> client = AsyncfluxClient ( ) <EOL> name = '<STR_LIT:default>' <EOL> database = '<STR_LIT:foo>' <EOL> regex = '<STR_LIT>' <EOL> retention_policy = '<STR_LIT>' <EOL> shard_duration = '<STR_LIT>' <EOL> replication_factor = <NUM_LIT:5> <EOL> split = <NUM_LIT:3> <EOL> shard_space = ShardSpace ( client , name = name , database = database , <EOL> regex = regex , retention_policy = retention_policy , <EOL> shard_duration = shard_duration , <EOL> replication_factor = replication_factor , <EOL> split = split ) <EOL> self . assertIsInstance ( shard_space . database , Database ) <EOL> self . assertEqual ( shard_space . database . name , database ) <EOL> database = Database ( client , '<STR_LIT:foo>' ) <EOL> shard_space = ShardSpace ( client , name = name , database = database , <EOL> regex = regex , retention_policy = retention_policy , <EOL> shard_duration = shard_duration , <EOL> replication_factor = replication_factor , <EOL> split = split ) <EOL> self . assertIsInstance ( shard_space . database , Database ) <EOL> self . assertEqual ( shard_space . database . name , database . name ) <EOL> @ gen_test <EOL> def test_get_shard_spaces ( self ) : <EOL> client = AsyncfluxClient ( ) <EOL> shard_spaces = [ { '<STR_LIT:name>' : '<STR_LIT:default>' , '<STR_LIT>' : '<STR_LIT:foo>' , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:1> , '<STR_LIT>' : <NUM_LIT:1> } , <EOL> { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT:bar>' , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:5> , '<STR_LIT>' : <NUM_LIT:5> } , <EOL> { '<STR_LIT:name>' : '<STR_LIT:default>' , '<STR_LIT>' : '<STR_LIT:bar>' , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:1> , '<STR_LIT>' : <NUM_LIT:1> } ] <EOL> with self . patch_fetch_mock ( client ) as m : <EOL> self . setup_fetch_mock ( m , <NUM_LIT:200> , body = shard_spaces ) <EOL> response = yield client . get_shard_spaces ( ) <EOL> for actual , expected in zip ( response , shard_spaces ) : <EOL> self . assertIsInstance ( actual , ShardSpace ) <EOL> self . assertEqual ( actual . client , client ) <EOL> self . assertEqual ( actual . name , expected [ '<STR_LIT:name>' ] ) <EOL> self . assertIsInstance ( actual . database , Database ) <EOL> self . assertEqual ( actual . database . name , expected [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( actual . regex , expected [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( actual . retention_policy , <EOL> expected [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( actual . shard_duration , <EOL> expected [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( actual . replication_factor , <EOL> expected [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( actual . split , expected [ '<STR_LIT>' ] ) <EOL> self . assert_mock_args ( m , '<STR_LIT>' ) </s>
