<s> """<STR_LIT>""" <EOL> from twisted . trial import unittest <EOL> from twisted . manhole . explorer import ( <EOL> CRUFT_WatchyThingie , <EOL> ExplorerImmutable , <EOL> Pool , <EOL> _WatchMonkey , <EOL> ) <EOL> class Foo : <EOL> """<STR_LIT>""" <EOL> class PoolTests ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_instanceBuilding ( self ) : <EOL> """<STR_LIT>""" <EOL> p = Pool ( ) <EOL> e = p . getExplorer ( <NUM_LIT> , '<STR_LIT:id>' ) <EOL> self . assertIsInstance ( e , ExplorerImmutable ) <EOL> self . assertEqual ( e . value , <NUM_LIT> ) <EOL> self . assertEqual ( e . identifier , '<STR_LIT:id>' ) <EOL> class CRUFTWatchyThingieTests ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_watchObjectConstructedClass ( self ) : <EOL> """<STR_LIT>""" <EOL> foo = Foo ( ) <EOL> cwt = CRUFT_WatchyThingie ( ) <EOL> cwt . watchObject ( foo , '<STR_LIT:id>' , '<STR_LIT>' ) <EOL> newClassName = foo . __class__ . __name__ <EOL> self . assertEqual ( newClassName , "<STR_LIT>" % ( id ( foo ) , ) ) <EOL> def test_watchObjectConstructedInstanceMethod ( self ) : <EOL> """<STR_LIT>""" <EOL> foo = Foo ( ) <EOL> cwt = CRUFT_WatchyThingie ( ) <EOL> cwt . watchObject ( foo , '<STR_LIT:id>' , '<STR_LIT>' ) <EOL> self . assertIdentical ( foo . _watchEmitChanged . im_self , foo ) <EOL> class WatchMonkeyTests ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_install ( self ) : <EOL> """<STR_LIT>""" <EOL> class Foo : <EOL> """<STR_LIT>""" <EOL> def someMethod ( self ) : <EOL> """<STR_LIT>""" <EOL> foo = Foo ( ) <EOL> wm = _WatchMonkey ( foo ) <EOL> wm . install ( '<STR_LIT>' ) <EOL> called = [ ] <EOL> wm . __call__ = lambda s : called . append ( True ) <EOL> foo . someMethod ( ) <EOL> self . assertTrue ( called ) </s>
