<s> """<STR_LIT>""" <EOL> from django import template , test <EOL> from acacia import models <EOL> def setup_from_node_strings ( nodes ) : <EOL> """<STR_LIT>""" <EOL> for node in nodes : <EOL> models . Topic . objects . get_or_create_by_full_name ( node ) <EOL> def convert ( template_string ) : <EOL> compiled = template . Template ( template_string ) <EOL> return compiled . render ( template . Context ( { } ) ) <EOL> class TreeTrunkErrorTests ( test . TestCase ) : <EOL> def test_invalid_app_name ( self ) : <EOL> self . assertRaises ( template . TemplateSyntaxError , convert , <EOL> "<STR_LIT>" ) <EOL> def test_invalid_model_name ( self ) : <EOL> self . assertRaises ( template . TemplateSyntaxError , convert , <EOL> "<STR_LIT>" ) <EOL> def test_non_integer_level_value ( self ) : <EOL> self . assertRaises ( template . TemplateSyntaxError , convert , <EOL> "<STR_LIT>" ) <EOL> def test_negative_level_value ( self ) : <EOL> self . assertRaises ( template . TemplateSyntaxError , convert , <EOL> "<STR_LIT>" ) <EOL> def test_zero_level_value ( self ) : <EOL> self . assertRaises ( template . TemplateSyntaxError , convert , <EOL> "<STR_LIT>" ) <EOL> def test_too_many_arguments ( self ) : <EOL> self . assertRaises ( template . TemplateSyntaxError , convert , <EOL> "<STR_LIT>" ) <EOL> def test_too_few_arguments ( self ) : <EOL> self . assertRaises ( template . TemplateSyntaxError , convert , <EOL> "<STR_LIT>" ) <EOL> class TreeTrunkMiscTests ( test . TestCase ) : <EOL> def test_empty_tree ( self ) : <EOL> """<STR_LIT>""" <EOL> self . failIf ( convert ( "<STR_LIT>" ) ) <EOL> def test_html_sensitive_content ( self ) : <EOL> setup_from_node_strings ( [ "<STR_LIT>" ] ) <EOL> output = convert ( "<STR_LIT>" ) <EOL> output = output . replace ( "<STR_LIT:\n>" , "<STR_LIT>" ) <EOL> expected = """<STR_LIT>""" . replace ( "<STR_LIT:\n>" , "<STR_LIT>" ) . replace ( "<STR_LIT:U+0020>" , "<STR_LIT>" ) <EOL> self . assertEqual ( output , expected , "<STR_LIT>" % <EOL> ( output , expected ) ) <EOL> class TreeTrunkSingleRootTests ( test . TestCase ) : <EOL> def setUp ( self ) : <EOL> nodes = [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ] <EOL> setup_from_node_strings ( nodes ) <EOL> def test_single_level ( self ) : <EOL> output = convert ( "<STR_LIT>" ) <EOL> output = output . replace ( "<STR_LIT:\n>" , "<STR_LIT>" ) <EOL> expected = """<STR_LIT>""" . replace ( "<STR_LIT:\n>" , "<STR_LIT>" ) . replace ( "<STR_LIT:U+0020>" , "<STR_LIT>" ) <EOL> self . assertEqual ( output , expected , "<STR_LIT>" % <EOL> ( output , expected ) ) <EOL> def test_two_levels ( self ) : <EOL> output = convert ( "<STR_LIT>" ) <EOL> output = output . replace ( "<STR_LIT:\n>" , "<STR_LIT>" ) <EOL> expected = """<STR_LIT>""" . replace ( "<STR_LIT:\n>" , "<STR_LIT>" ) . replace ( "<STR_LIT:U+0020>" , "<STR_LIT>" ) <EOL> self . assertEqual ( output , expected , "<STR_LIT>" % <EOL> ( output , expected ) ) <EOL> def test_three_levels ( self ) : <EOL> output = convert ( "<STR_LIT>" ) <EOL> output = output . replace ( "<STR_LIT:\n>" , "<STR_LIT>" ) <EOL> expected = """<STR_LIT>""" . replace ( "<STR_LIT:\n>" , "<STR_LIT>" ) . replace ( "<STR_LIT:U+0020>" , "<STR_LIT>" ) <EOL> self . assertEqual ( output , expected , "<STR_LIT>" % <EOL> ( output , expected ) ) <EOL> def test_more_levels_than_nodes ( self ) : <EOL> output = convert ( "<STR_LIT>" ) <EOL> output = output . replace ( "<STR_LIT:\n>" , "<STR_LIT>" ) <EOL> expected = """<STR_LIT>""" . replace ( "<STR_LIT:\n>" , "<STR_LIT>" ) . replace ( "<STR_LIT:U+0020>" , "<STR_LIT>" ) <EOL> self . assertEqual ( output , expected , "<STR_LIT>" % <EOL> ( output , expected ) ) <EOL> def test_default_level ( self ) : <EOL> output = convert ( "<STR_LIT>" ) <EOL> output = output . replace ( "<STR_LIT:\n>" , "<STR_LIT>" ) <EOL> expected = """<STR_LIT>""" . replace ( "<STR_LIT:\n>" , "<STR_LIT>" ) . replace ( "<STR_LIT:U+0020>" , "<STR_LIT>" ) <EOL> self . assertEqual ( output , expected , "<STR_LIT>" % <EOL> ( output , expected ) ) <EOL> class TreeTrunkFullContentTests ( test . TestCase ) : <EOL> def setUp ( self ) : <EOL> nodes = [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> ] <EOL> setup_from_node_strings ( nodes ) <EOL> def test_one_level ( self ) : <EOL> output = convert ( "<STR_LIT>" ) <EOL> output = output . replace ( "<STR_LIT:\n>" , "<STR_LIT>" ) <EOL> expected = """<STR_LIT>""" . replace ( "<STR_LIT:\n>" , "<STR_LIT>" ) . replace ( "<STR_LIT:U+0020>" , "<STR_LIT>" ) <EOL> self . assertEqual ( output , expected , "<STR_LIT>" % <EOL> ( output , expected ) ) <EOL> def test_three_levels ( self ) : <EOL> output = convert ( "<STR_LIT>" ) <EOL> output = output . replace ( "<STR_LIT:\n>" , "<STR_LIT>" ) <EOL> expected = """<STR_LIT>""" . replace ( "<STR_LIT:\n>" , "<STR_LIT>" ) . replace ( "<STR_LIT:U+0020>" , "<STR_LIT>" ) <EOL> self . assertEqual ( output , expected , "<STR_LIT>" % <EOL> ( output , expected ) ) </s>
