def test_external_js_and_css_resource_embedding():
 class CustomModel1(Model, ):
  __javascript__ = 'external_js_1'
  __css__ = 'external_css_1'
 class CustomModel2(Model, ):
  __javascript__ = ['external_js_2', 'external_js_3']
  __css__ = ['external_css_2', 'external_css_3']
 class CustomModel3(Model, ):
  __javascript__ = ['external_js_1', 'external_js_3']
  __css__ = ['external_css_1', 'external_css_2']
 r = resources.Resources()
 assert ('external_js_1' in r.js_files)
 assert ('external_css_1' in r.css_files)
 assert ('external_js_2' in r.js_files)
 assert ('external_js_3' in r.js_files)
 assert ('external_css_2' in r.css_files)
 assert ('external_css_3' in r.css_files)
 assert (r.css_files.count('external_css_1') == 1)
 assert (r.css_files.count('external_css_2') == 1)
 assert (r.js_files.count('external_js_3') == 1)
 assert (r.js_files.count('external_js_1') == 1)

def test_external_js_and_css_resource_embedding ( ) : class CustomModel1 ( Model , ) : __javascript__ = 'external_js_1' __css__ = 'external_css_1' class CustomModel2 ( Model , ) : __javascript__ = [ 'external_js_2' , 'external_js_3' ] __css__ = [ 'external_css_2' , 'external_css_3' ] class CustomModel3 ( Model , ) : __javascript__ = [ 'external_js_1' , 'external_js_3' ] __css__ = [ 'external_css_1' , 'external_css_2' ] r = resources . Resources ( ) assert ( 'external_js_1' in r . js_files ) assert ( 'external_css_1' in r . css_files ) assert ( 'external_js_2' in r . js_files ) assert ( 'external_js_3' in r . js_files ) assert ( 'external_css_2' in r . css_files ) assert ( 'external_css_3' in r . css_files ) assert ( r . css_files . count ( 'external_css_1' ) == 1 ) assert ( r . css_files . count ( 'external_css_2' ) == 1 ) assert ( r . js_files . count ( 'external_js_3' ) == 1 ) assert ( r . js_files . count ( 'external_js_1' ) == 1 )
this test method has to be at the end of the test modules because subclassing a model causes the custommodel to be added as a viewable and messes up the resources state for the other tests .