#NEWLINE# def test_block_merged( self ) : #NEWLINE# #INDENT# '\n        Verify that a merged block is crosswalked correctly.\n        150010210011329 + 150010210011331 -> 150010210051009\n        ' #NEWLINE# block1_pop_2000 = 12 #NEWLINE# block2_pop_2000 = 27 #NEWLINE# merged_pop_2000 = ( block1_pop_2000 + block2_pop_2000 ) #NEWLINE# merged_pop_2010 = 78 #NEWLINE# merged_pop_delta = ( merged_pop_2010 - merged_pop_2000 ) #NEWLINE# merged_pop_pct_change = ( float ( merged_pop_delta ) / merged_pop_2000 ) #NEWLINE# merged_block = self . geographies . find ( { #NEWLINE# #INDENT# 'geoid' : '150010210051009' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( merged_block . count ( ) , 1 ) #NEWLINE# merged_block = merged_block [ 0 ] #NEWLINE# self . assertEqual ( len ( merged_block [ 'xwalk' ] ) , 2 ) #NEWLINE# self . assertEqual ( merged_block [ 'xwalk' ] [ '150010210011329' ] [ 'POPPCT00' ] , 1.0 ) #NEWLINE# self . assertEqual ( merged_block [ 'xwalk' ] [ '150010210011331' ] [ 'POPPCT00' ] , 1.0 ) #NEWLINE# self . assertEqual ( float ( merged_block [ 'data' ] [ '2000' ] [ 'P1' ] [ 'P001001' ] ) , merged_pop_2000 ) #NEWLINE# self . assertEqual ( float ( merged_block [ 'data' ] [ '2010' ] [ 'P1' ] [ 'P001001' ] ) , merged_pop_2010 ) #NEWLINE# self . assertEqual ( float ( merged_block [ 'data' ] [ 'delta' ] [ 'P1' ] [ 'P001001' ] ) , merged_pop_delta ) #NEWLINE# self . assertAlmostEqual ( float ( merged_block [ 'data' ] [ 'pct_change' ] [ 'P1' ] [ 'P001001' ] ) , merged_pop_pct_change )