#NEWLINE# def test_HALNavigator__identity_map( ) : #NEWLINE# #INDENT# with httprettify ( ) : #NEWLINE# #INDENT# index_uri = 'http://www.example.com/' #NEWLINE# page1_uri = ( index_uri + '1' ) #NEWLINE# page2_uri = ( index_uri + '2' ) #NEWLINE# page3_uri = ( index_uri + '3' ) #NEWLINE# index_links = { #NEWLINE# #INDENT# 'first' : { #NEWLINE# #INDENT# 'href' : page1_uri , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# page1_links = { #NEWLINE# #INDENT# 'next' : { #NEWLINE# #INDENT# 'href' : page2_uri , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# page2_links = { #NEWLINE# #INDENT# 'next' : { #NEWLINE# #INDENT# 'href' : page3_uri , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# page3_links = { #NEWLINE# #INDENT# 'next' : { #NEWLINE# #INDENT# 'href' : page1_uri , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# register_hal ( index_uri , index_links ) #NEWLINE# register_hal ( page1_uri , page1_links ) #NEWLINE# register_hal ( page2_uri , page2_links ) #NEWLINE# register_hal ( page3_uri , page3_links ) #NEWLINE# N = HN . Navigator . hal ( index_uri ) #NEWLINE# page1 = N [ 'first' ] #NEWLINE# page2 = N [ 'first' ] [ 'next' ] #NEWLINE# page3 = N [ 'first' ] [ 'next' ] [ 'next' ] #NEWLINE# page4 = N [ 'first' ] [ 'next' ] [ 'next' ] [ 'next' ] #NEWLINE# assert ( page1 is page4 ) #NEWLINE# assert ( page2 is page4 [ 'next' ] ) #NEWLINE# assert ( page3 is page4 [ 'next' ] [ 'next' ] )