#NEWLINE# def test_has_traits( self ) : #NEWLINE# #INDENT# ' has traits ' #NEWLINE# module = self . code_browser . read_file ( os . path . join ( get_path ( CodeBrowserTestCase ) , 'example_1.py' ) ) #NEWLINE# self . assertTrue ( module . name . endswith ( 'example_1' ) ) #NEWLINE# klass = module . klasses . get ( 'Base' ) #NEWLINE# self . assertNotEqual ( None , klass ) #NEWLINE# self . assertEqual ( [ 'HasTraits' ] , klass . bases ) #NEWLINE# self . assertEqual ( 2 , len ( klass . traits ) ) #NEWLINE# self . assertIn ( 'x' , klass . traits ) #NEWLINE# self . assertIn ( 'y' , klass . traits ) #NEWLINE# self . assertEqual ( 2 , len ( klass . methods ) ) #NEWLINE# self . assertIn ( 'foo' , klass . methods ) #NEWLINE# self . assertIn ( 'bar' , klass . methods ) #NEWLINE# return