<s> from smisk . test import * <EOL> from test_matter import * <EOL> from smisk . mvc . control import * <EOL> class misc_tests ( TestCase ) : <EOL> def test1_root_controller ( self ) : <EOL> self . assertEquals ( root_controller ( ) , root ) <EOL> def test2_controllers ( self ) : <EOL> self . assertContains ( controllers ( ) , ( <EOL> root ( ) , level2 ( ) , level3 ( ) , level3B ( ) , PostsController ( ) <EOL> ) ) <EOL> def test3_method_origin ( self ) : <EOL> o = SpanishBass ( ) <EOL> self . assertEquals ( method_origin ( o . name ) , Animal ) <EOL> self . assertEquals ( method_origin ( o . color ) , Fish ) <EOL> self . assertEquals ( method_origin ( o . eats ) , Bass ) <EOL> self . assertEquals ( method_origin ( o . on_fiesta ) , SpanishBass ) <EOL> self . assertEquals ( method_origin ( o . sleeps ) , SpanishBass ) <EOL> o = EnglishBass ( ) <EOL> self . assertEquals ( method_origin ( o . cheese ) , EnglishBass ) <EOL> self . assertEquals ( method_origin ( o . on_fiesta ) , EnglishBass ) <EOL> def test4_leaf_visibility ( self ) : <EOL> self . assertTrue ( leaf_is_visible ( root ) ) <EOL> self . assertTrue ( leaf_is_visible ( root . __call__ ) ) <EOL> self . assertTrue ( leaf_is_visible ( root . func_on_root ) ) <EOL> self . assertTrue ( leaf_is_visible ( root . delegating_func_on_root ) ) <EOL> self . assertTrue ( leaf_is_visible ( level2 ) ) <EOL> self . assertTrue ( leaf_is_visible ( level2 . __call__ ) ) <EOL> self . assertTrue ( leaf_is_visible ( level2 . func_on_level2 ) ) <EOL> self . assertTrue ( leaf_is_visible ( level2 . level3 ) ) <EOL> self . assertTrue ( leaf_is_visible ( level3 ) ) <EOL> self . assertTrue ( leaf_is_visible ( level3 . __call__ ) ) <EOL> self . assertTrue ( leaf_is_visible ( level3 . func_on_level3 ) ) <EOL> self . assertTrue ( leaf_is_visible ( level3 . func_on_level3_wonlykwa ) ) <EOL> self . assertTrue ( leaf_is_visible ( level2 . delegating_func_on_root ) ) <EOL> self . assertTrue ( leaf_is_visible ( level3 . delegating_func_on_root ) ) <EOL> self . assertTrue ( leaf_is_visible ( PostsController . delegating_func_on_root ) ) <EOL> self . assertTrue ( leaf_is_visible ( level2 . foo_bar ) ) <EOL> self . assertFalse ( leaf_is_visible ( level2 . func_on_root ) ) <EOL> self . assertFalse ( leaf_is_visible ( level3 . func_on_level2 ) ) <EOL> self . assertFalse ( leaf_is_visible ( level3B ) ) <EOL> self . assertFalse ( leaf_is_visible ( level3B . __call__ ) ) <EOL> self . assertFalse ( leaf_is_visible ( level3 . hidden_method_on_level3 ) ) <EOL> def test5_controller_name ( self ) : <EOL> self . assertEquals ( root . controller_name ( ) , u'<STR_LIT:root>' ) <EOL> self . assertEquals ( level2 . controller_name ( ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( level3 . controller_name ( ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( level3B . controller_name ( ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( PostsController . controller_name ( ) , u'<STR_LIT>' ) <EOL> class node_name_tests ( TestCase ) : <EOL> def test1_basic ( self ) : <EOL> self . assertEquals ( node_name ( root ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( node_name ( root . __call__ ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( node_name ( root . func_on_root ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( node_name ( root . delegating_func_on_root ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( node_name ( level2 ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( node_name ( level2 . __call__ ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( node_name ( level2 . func_on_level2 ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( node_name ( level2 . level3 ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( node_name ( level3 ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( node_name ( level3 . __call__ ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( node_name ( level3 . func_on_level3 ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( node_name ( level3 . func_on_level3_wonlykwa ) , u'<STR_LIT>' ) <EOL> def test2_non_delegating ( self ) : <EOL> self . assertEquals ( node_name ( level2 . func_on_root ) , None ) <EOL> self . assertEquals ( node_name ( level3 . func_on_level2 ) , None ) <EOL> self . assertEquals ( node_name ( level3B ) , None ) <EOL> self . assertEquals ( node_name ( level3B . __call__ ) , None ) <EOL> def test3_delegating ( self ) : <EOL> self . assertEquals ( node_name ( level2 . delegating_func_on_root ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( node_name ( level3 . delegating_func_on_root ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( node_name ( PostsController . delegating_func_on_root ) , u'<STR_LIT>' ) <EOL> def test4_renamed ( self ) : <EOL> self . assertEquals ( node_name ( level2 . foo_bar ) , u'<STR_LIT>' ) <EOL> self . assertNotEquals ( node_name ( level2 . foo_bar ) , u'<STR_LIT>' ) <EOL> def test5_hidden ( self ) : <EOL> self . assertEquals ( node_name ( level3 . hidden_method_on_level3 ) , None ) <EOL> self . assertEquals ( node_name ( root . controller_name ) , None ) <EOL> self . assertEquals ( node_name ( Controller . controller_name ) , None ) <EOL> self . assertEquals ( node_name ( level2 . special_methods ) , None ) <EOL> class path_to_tests ( TestCase ) : <EOL> def test1_basic ( self ) : <EOL> self . assertEquals ( path_to ( root ) , [ ] ) <EOL> self . assertEquals ( path_to ( root . __call__ ) , [ ] ) <EOL> self . assertEquals ( path_to ( root . func_on_root ) , [ u'<STR_LIT>' ] ) <EOL> self . assertEquals ( path_to ( root . delegating_func_on_root ) , [ u'<STR_LIT>' ] ) <EOL> self . assertEquals ( path_to ( level2 ) , [ u'<STR_LIT>' ] ) <EOL> self . assertEquals ( path_to ( level2 . __call__ ) , [ u'<STR_LIT>' ] ) <EOL> self . assertEquals ( path_to ( level2 . func_on_level2 ) , [ u'<STR_LIT>' , u'<STR_LIT>' ] ) <EOL> self . assertEquals ( path_to ( level2 . level3 ) , [ u'<STR_LIT>' , u'<STR_LIT>' ] ) <EOL> self . assertEquals ( path_to ( level3 ) , [ u'<STR_LIT>' , u'<STR_LIT>' ] ) <EOL> self . assertEquals ( path_to ( level3 . __call__ ) , [ u'<STR_LIT>' , u'<STR_LIT>' ] ) <EOL> self . assertEquals ( path_to ( level3 . func_on_level3 ) , [ u'<STR_LIT>' , u'<STR_LIT>' , u'<STR_LIT>' ] ) <EOL> self . assertEquals ( path_to ( level3 . func_on_level3_wonlykwa ) , [ u'<STR_LIT>' , u'<STR_LIT>' , u'<STR_LIT>' ] ) <EOL> def test2_non_delegating ( self ) : <EOL> self . assertEquals ( path_to ( level2 . func_on_root ) , None ) <EOL> self . assertEquals ( path_to ( level3 . func_on_level2 ) , None ) <EOL> self . assertEquals ( path_to ( level3B ) , None ) <EOL> self . assertEquals ( path_to ( level3B . __call__ ) , None ) <EOL> def test3_delegating ( self ) : <EOL> self . assertEquals ( path_to ( level2 . delegating_func_on_root ) , [ u'<STR_LIT>' , u'<STR_LIT>' ] ) <EOL> self . assertEquals ( path_to ( level3 . delegating_func_on_root ) , [ u'<STR_LIT>' , u'<STR_LIT>' , u'<STR_LIT>' ] ) <EOL> self . assertEquals ( path_to ( PostsController . delegating_func_on_root ) , [ u'<STR_LIT>' , u'<STR_LIT>' , u'<STR_LIT>' , u'<STR_LIT>' ] ) <EOL> def test4_renamed ( self ) : <EOL> self . assertEquals ( path_to ( level2 . foo_bar ) , [ u'<STR_LIT>' , u'<STR_LIT>' ] ) <EOL> self . assertNotEquals ( path_to ( level2 . foo_bar ) , [ u'<STR_LIT>' , u'<STR_LIT>' ] ) <EOL> def test5_hidden ( self ) : <EOL> self . assertEquals ( path_to ( level3 . hidden_method_on_level3 ) , None ) <EOL> class uri_for_tests ( TestCase ) : <EOL> def test1_basic ( self ) : <EOL> self . assertEquals ( uri_for ( root ) , u'<STR_LIT:/>' ) <EOL> self . assertEquals ( uri_for ( root . __call__ ) , u'<STR_LIT:/>' ) <EOL> self . assertEquals ( uri_for ( root . func_on_root ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( uri_for ( root . delegating_func_on_root ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( uri_for ( level2 ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( uri_for ( level2 . __call__ ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( uri_for ( level2 . func_on_level2 ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( uri_for ( level2 . level3 ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( uri_for ( level3 ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( uri_for ( level3 . __call__ ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( uri_for ( level3 . func_on_level3 ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( uri_for ( level3 . func_on_level3_wonlykwa ) , u'<STR_LIT>' ) <EOL> def test2_non_delegating ( self ) : <EOL> self . assertEquals ( uri_for ( level2 . func_on_root ) , None ) <EOL> self . assertEquals ( uri_for ( level3 . func_on_level2 ) , None ) <EOL> self . assertEquals ( uri_for ( level3B ) , None ) <EOL> self . assertEquals ( uri_for ( level3B . __call__ ) , None ) <EOL> def test3_delegating ( self ) : <EOL> self . assertEquals ( uri_for ( level2 . delegating_func_on_root ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( uri_for ( level3 . delegating_func_on_root ) , u'<STR_LIT>' ) <EOL> self . assertEquals ( uri_for ( PostsController . delegating_func_on_root ) , u'<STR_LIT>' ) <EOL> def test4_renamed ( self ) : <EOL> self . assertEquals ( uri_for ( level2 . foo_bar ) , u'<STR_LIT>' ) <EOL> self . assertNotEquals ( uri_for ( level2 . foo_bar ) , u'<STR_LIT>' ) <EOL> def test5_hidden ( self ) : <EOL> self . assertEquals ( uri_for ( level3 . hidden_method_on_level3 ) , None ) <EOL> class template_for_tests ( TestCase ) : <EOL> def test1_basic ( self ) : <EOL> self . assertEquals ( template_for ( root ) , [ u'<STR_LIT>' ] ) <EOL> self . assertEquals ( template_for ( root . __call__ ) , [ u'<STR_LIT>' ] ) <EOL> self . assertEquals ( template_for ( root . func_on_root ) , [ u'<STR_LIT>' ] ) <EOL> self . assertEquals ( template_for ( root . delegating_func_on_root ) , [ u'<STR_LIT>' ] ) <EOL> self . assertEquals ( template_for ( level2 ) , [ u'<STR_LIT>' , u'<STR_LIT>' ] ) <EOL> self . assertEquals ( template_for ( level2 . __call__ ) , [ u'<STR_LIT>' , u'<STR_LIT>' ] ) <EOL> self . assertEquals ( template_for ( level2 . func_on_level2 ) , [ u'<STR_LIT>' , u'<STR_LIT>' ] ) <EOL> self . assertEquals ( template_for ( level2 . level3 ) , [ u'<STR_LIT>' , u'<STR_LIT>' ] ) <EOL> self . assertEquals ( template_for ( level3 ) , [ u'<STR_LIT>' , u'<STR_LIT>' , u'<STR_LIT>' ] ) <EOL> self . assertEquals ( template_for ( level3 . __call__ ) , [ u'<STR_LIT>' , u'<STR_LIT>' , u'<STR_LIT>' ] ) <EOL> self . assertEquals ( template_for ( level3 . func_on_level3 ) , [ u'<STR_LIT>' , u'<STR_LIT>' , u'<STR_LIT>' ] ) <EOL> def test2_non_delegating ( self ) : <EOL> self . assertEquals ( template_for ( level2 . func_on_root ) , None ) <EOL> self . assertEquals ( template_for ( level3 . func_on_level2 ) , None ) <EOL> self . assertEquals ( template_for ( level3B ) , None ) <EOL> self . assertEquals ( template_for ( level3B . __call__ ) , None ) <EOL> def test3_delegating ( self ) : <EOL> self . assertEquals ( template_for ( level2 . delegating_func_on_root ) , [ u'<STR_LIT>' , u'<STR_LIT>' ] ) <EOL> self . assertEquals ( template_for ( level3 . delegating_func_on_root ) , [ u'<STR_LIT>' , u'<STR_LIT>' , u'<STR_LIT>' ] ) <EOL> self . assertEquals ( template_for ( PostsController . delegating_func_on_root ) , [ u'<STR_LIT>' , u'<STR_LIT>' , u'<STR_LIT>' , u'<STR_LIT>' ] ) <EOL> def test4_renamed ( self ) : <EOL> self . assertEquals ( template_for ( level2 . foo_bar ) , [ u'<STR_LIT>' , u'<STR_LIT>' ] ) <EOL> self . assertNotEquals ( template_for ( level2 . foo_bar ) , [ u'<STR_LIT>' , u'<STR_LIT>' ] ) <EOL> def test5_hidden ( self ) : <EOL> self . assertEquals ( template_for ( level3 . hidden_method_on_level3 ) , None ) <EOL> def suite ( ) : <EOL> return unittest . TestSuite ( [ <EOL> unittest . makeSuite ( misc_tests ) , <EOL> unittest . makeSuite ( node_name_tests ) , <EOL> unittest . makeSuite ( path_to_tests ) , <EOL> unittest . makeSuite ( uri_for_tests ) , <EOL> unittest . makeSuite ( template_for_tests ) , <EOL> ] ) <EOL> def test ( ) : <EOL> runner = unittest . TextTestRunner ( ) <EOL> return runner . run ( suite ( ) ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> test ( ) </s>
