#NEWLINE# def test_patch_imports_lazily( self ) : #NEWLINE# #INDENT# sys . modules . pop ( 'squizz' , None ) #NEWLINE# p1 = patch ( 'squizz.squozz' ) #NEWLINE# self . assertRaises ( ImportError , p1 . start ) #NEWLINE# squizz = Mock ( ) #NEWLINE# squizz . squozz = 6 #NEWLINE# sys . modules [ 'squizz' ] = squizz #NEWLINE# p1 = patch ( 'squizz.squozz' ) #NEWLINE# squizz . squozz = 3 #NEWLINE# p1 . start ( ) #NEWLINE# p1 . stop ( ) #NEWLINE# self . assertEqual ( squizz . squozz , 3 )