#NEWLINE# def test_markdown( env , pad ) : #NEWLINE# #INDENT# field = make_field ( env , 'markdown' ) #NEWLINE# source = DummySource ( ) #NEWLINE# with Context ( pad = pad ) : #NEWLINE# #INDENT# rv = field . deserialize_value ( 'Hello **World**!' , pad = pad ) #NEWLINE# assert isinstance ( rv , MarkdownDescriptor ) #NEWLINE# rv = rv . __get__ ( source ) #NEWLINE# assert rv #NEWLINE# assert ( rv . source == 'Hello **World**!' ) #NEWLINE# assert ( escape ( rv ) == Markup ( '<p>Hello <strong>World</strong>!</p>\n' ) ) #NEWLINE# assert ( rv . meta == { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# for val in ( '' , None ) : #NEWLINE# #INDENT# rv = field . deserialize_value ( val , pad = pad ) #NEWLINE# assert isinstance ( rv , MarkdownDescriptor ) #NEWLINE# rv = rv . __get__ ( source ) #NEWLINE# assert ( not rv ) #NEWLINE# assert ( rv . source == '' ) #NEWLINE# assert ( escape ( rv ) == Markup ( '' ) ) #NEWLINE# assert ( source . meta == { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } )