<s> import unittest <EOL> from django . test . client import Client <EOL> from lifeflow . models import * <EOL> import datetime <EOL> import pygments . lexers as lexers <EOL> class commentTest ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . client = Client ( ) <EOL> def test_organize_comments ( self ) : <EOL> "<STR_LIT>" <EOL> e = Entry ( title = "<STR_LIT>" , <EOL> pub_date = datetime . datetime . now ( ) , <EOL> summary = "<STR_LIT>" , <EOL> body = "<STR_LIT>" ) <EOL> e . save ( ) <EOL> c1 = Comment ( entry = e , body = "<STR_LIT>" ) <EOL> c1 . save ( ) <EOL> self . assertEquals ( [ [ c1 , <NUM_LIT:0> ] ] , e . organize_comments ( ) ) <EOL> c2 = Comment ( entry = e , name = "<STR_LIT>" , body = "<STR_LIT>" ) <EOL> c2 . save ( ) <EOL> self . assertEquals ( [ [ c2 , <NUM_LIT:0> ] , [ c1 , <NUM_LIT:0> ] ] , e . organize_comments ( ) ) <EOL> c3 = Comment ( entry = e , name = "<STR_LIT>" , parent = c1 , body = "<STR_LIT>" ) <EOL> c3 . save ( ) <EOL> self . assertEquals ( [ [ c2 , <NUM_LIT:0> ] , [ c1 , <NUM_LIT:0> ] , [ c3 , <NUM_LIT:1> ] ] , <EOL> e . organize_comments ( ) ) <EOL> c4 = Comment ( entry = e , name = "<STR_LIT>" , parent = c2 , body = "<STR_LIT>" ) <EOL> c4 . save ( ) <EOL> self . assertEquals ( [ [ c2 , <NUM_LIT:0> ] , [ c4 , <NUM_LIT:1> ] , [ c1 , <NUM_LIT:0> ] , [ c3 , <NUM_LIT:1> ] ] , <EOL> e . organize_comments ( ) ) <EOL> class codeMarkupTest ( unittest . TestCase ) : <EOL> def test_markup ( self ) : <EOL> "<STR_LIT>" <EOL> txt = "<STR_LIT>" <EOL> expected = u"<STR_LIT>" <EOL> rendered = dbc_markup ( txt ) . strip ( "<STR_LIT:\n>" ) <EOL> self . assertEqual ( expected , rendered ) <EOL> def test_code_markup ( self ) : <EOL> "<STR_LIT>" <EOL> txt = u"<STR_LIT>" <EOL> expected = u'<STR_LIT>' <EOL> self . assertEqual ( expected , dbc_markup ( txt ) ) <EOL> txt = u"<STR_LIT>" <EOL> self . assertEqual ( txt , dbc_markup ( txt ) ) <EOL> txt = u"<STR_LIT>" <EOL> expected = u'<STR_LIT>' <EOL> self . assertEqual ( expected , dbc_markup ( txt ) ) <EOL> txt = u"<STR_LIT>" <EOL> expected = u'<STR_LIT>' <EOL> self . assertEqual ( expected , dbc_markup ( txt ) ) <EOL> def test_using_non_existant_language ( self ) : <EOL> "<STR_LIT>" <EOL> cases = ( <EOL> u"<STR_LIT>" , <EOL> u"<STR_LIT>" , <EOL> ) <EOL> for case in cases : <EOL> self . assertRaises ( lexers . ClassNotFound , <EOL> lambda : dbc_markup ( case ) ) <EOL> def test_lfmu ( self ) : <EOL> "<STR_LIT>" <EOL> e = Entry ( title = "<STR_LIT>" , <EOL> pub_date = datetime . datetime . now ( ) , <EOL> summary = "<STR_LIT>" , <EOL> body = "<STR_LIT>" ) <EOL> e . save ( ) <EOL> a = Author ( name = "<STR_LIT>" , <EOL> slug = "<STR_LIT>" , <EOL> link = "<STR_LIT:a>" ) <EOL> a . save ( ) <EOL> e2 = Entry ( title = "<STR_LIT>" , <EOL> pub_date = datetime . datetime . now ( ) , <EOL> summary = "<STR_LIT>" , <EOL> body = "<STR_LIT>" , <EOL> ) <EOL> e2 . save ( ) <EOL> e2 . authors . add ( a ) <EOL> e2 . save ( ) <EOL> t = Tag ( title = "<STR_LIT>" , slug = "<STR_LIT>" ) <EOL> t . save ( ) <EOL> c1 = Comment ( entry = e , body = "<STR_LIT>" ) <EOL> c1 . save ( ) <EOL> p = Project ( title = "<STR_LIT>" , <EOL> slug = "<STR_LIT>" , <EOL> summary = "<STR_LIT>" , <EOL> body = "<STR_LIT>" ) <EOL> p . save ( ) <EOL> self . assertEqual ( dbc_markup ( "<STR_LIT>" , e ) , <EOL> u'<STR_LIT>' ) <EOL> self . assertEqual ( dbc_markup ( "<STR_LIT>" , e ) , <EOL> u'<STR_LIT>' ) <EOL> self . assertEqual ( dbc_markup ( "<STR_LIT>" , e2 ) , <EOL> u'<STR_LIT>' ) <EOL> self . assertEqual ( dbc_markup ( "<STR_LIT>" , e ) , <EOL> u'<STR_LIT>' ) </s>
