#NEWLINE# def test_util_from_n3_expectsameasn3parser( self ) : #NEWLINE# #INDENT# def parse_n3( term_n3 ) : #NEWLINE# #INDENT# ' Disclaimer: Quick and dirty hack using the n3 parser. ' #NEWLINE# prepstr = ( '@prefix  xsd: <http://www.w3.org/2001/XMLSchema#> .\n<urn:no_use> <urn:no_use> %s.\n' % term_n3 ) #NEWLINE# g = ConjunctiveGraph ( ) #NEWLINE# g . parse ( data = prepstr , format = 'n3' ) #NEWLINE# return [ t for t in g . triples ( ( None , None , None ) ) ] [ 0 ] [ 2 ] #NEWLINE# #UNINDENT# for n3 in ( '"michel"' , '<http://example.org/schema>' , '"michel"@fr' , '42' , 'true' , 'false' , '"""multi\nline\nstring"""@en' , '<http://ex.com/foo>' , '"foo"@de' , '"\\""@en' , '"""multi\n"line"\nstring"""@en' ) : #NEWLINE# #INDENT# ( res , exp ) = ( util . from_n3 ( n3 ) , parse_n3 ( n3 ) ) #NEWLINE# self . assertEquals ( res , exp , ( 'from_n3(%(n3e)r): %(res)r != parser.notation3: %(exp)r' % { #NEWLINE# #INDENT# 'res' : res , #NEWLINE# 'exp' : exp , #NEWLINE# 'n3e' : parse_n3 , #NEWLINE# #UNINDENT# } ) )