<s> import pytest <EOL> from py . test import skip <EOL> from flower . local import local <EOL> from flower import core <EOL> class Test_Local : <EOL> def test_simple ( self ) : <EOL> d = local ( ) <EOL> d . a = <NUM_LIT:1> <EOL> assert d . a == <NUM_LIT:1> <EOL> d . a = <NUM_LIT:2> <EOL> assert d . a == <NUM_LIT:2> <EOL> def test_simple_delete ( self ) : <EOL> d = local ( ) <EOL> d . a = <NUM_LIT:1> <EOL> assert d . a == <NUM_LIT:1> <EOL> del d . a <EOL> def f ( ) : return d . a <EOL> with pytest . raises ( AttributeError ) : <EOL> f ( ) <EOL> def test_simple_delete2 ( self ) : <EOL> d = local ( ) <EOL> d . a = <NUM_LIT:1> <EOL> d . b = <NUM_LIT:2> <EOL> assert d . a == <NUM_LIT:1> <EOL> assert d . b == <NUM_LIT:2> <EOL> del d . a <EOL> def f ( ) : return d . a <EOL> with pytest . raises ( AttributeError ) : <EOL> f ( ) <EOL> assert d . b == <NUM_LIT:2> <EOL> def test_local ( self ) : <EOL> d = local ( ) <EOL> d . a = <NUM_LIT:1> <EOL> r_list = [ ] <EOL> def f ( ) : <EOL> try : <EOL> d . a <EOL> except AttributeError : <EOL> r_list . append ( True ) <EOL> core . tasklet ( f ) ( ) <EOL> core . schedule ( ) <EOL> assert r_list == [ True ] <EOL> def test_local2 ( self ) : <EOL> d = local ( ) <EOL> d . a = <NUM_LIT:1> <EOL> r_list = [ ] <EOL> def f ( ) : <EOL> try : <EOL> d . a <EOL> except AttributeError : <EOL> r_list . append ( True ) <EOL> d . a = <NUM_LIT:2> <EOL> if d . a == <NUM_LIT:2> : <EOL> r_list . append ( True ) <EOL> core . tasklet ( f ) ( ) <EOL> core . schedule ( ) <EOL> assert r_list == [ True , True ] <EOL> assert d . a == <NUM_LIT:1> </s>
