<s> import time <EOL> from tests . unit import unittest <EOL> from boto . dynamodb . layer2 import Layer2 <EOL> from boto . dynamodb . table import Table <EOL> from boto . dynamodb . schema import Schema <EOL> class TestDynamoDBTable ( unittest . TestCase ) : <EOL> dynamodb = True <EOL> def setUp ( self ) : <EOL> self . dynamodb = Layer2 ( ) <EOL> self . schema = Schema . create ( ( '<STR_LIT:foo>' , '<STR_LIT:N>' ) , ( '<STR_LIT:bar>' , '<STR_LIT:S>' ) ) <EOL> self . table_name = '<STR_LIT>' % int ( time . time ( ) ) <EOL> def create_table ( self , table_name , schema , read_units , write_units ) : <EOL> result = self . dynamodb . create_table ( table_name , schema , read_units , write_units ) <EOL> self . addCleanup ( self . dynamodb . delete_table , result ) <EOL> return result <EOL> def assertAllEqual ( self , * items ) : <EOL> first = items [ <NUM_LIT:0> ] <EOL> for item in items [ <NUM_LIT:1> : ] : <EOL> self . assertEqual ( first , item ) <EOL> def test_table_retrieval_parity ( self ) : <EOL> created_table = self . dynamodb . create_table ( <EOL> self . table_name , self . schema , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> created_table . refresh ( wait_for_active = True ) <EOL> retrieved_table = self . dynamodb . get_table ( self . table_name ) <EOL> constructed_table = self . dynamodb . table_from_schema ( self . table_name , <EOL> self . schema ) <EOL> self . assertAllEqual ( created_table . name , <EOL> retrieved_table . name , <EOL> constructed_table . name ) <EOL> self . assertAllEqual ( created_table . schema , <EOL> retrieved_table . schema , <EOL> constructed_table . schema ) <EOL> self . assertEqual ( created_table . create_time , <EOL> retrieved_table . create_time ) <EOL> self . assertEqual ( created_table . status , <EOL> retrieved_table . status ) <EOL> self . assertEqual ( created_table . read_units , <EOL> retrieved_table . read_units ) <EOL> self . assertEqual ( created_table . write_units , <EOL> retrieved_table . write_units ) <EOL> self . assertIsNone ( constructed_table . create_time ) <EOL> self . assertIsNone ( constructed_table . status ) <EOL> self . assertIsNone ( constructed_table . read_units ) <EOL> self . assertIsNone ( constructed_table . write_units ) </s>
