import unittest

from rdflib import *
from rdflib.util import from_n3


class UtilTestCase(unittest.TestCase):

    def setUp(self):
        self.graph = Graph()

    def tearDown(self):
        del self.graph

    def __test_from_n3(self):
        """Test that from_n3 can handle unicode."""
        a = u'"\302\251"'
        from_n3(a.encode("utf-8")) 
        #from_n3(a) 

    def test_round_trip(self):
        #a = Literal(u'A test with a unicode character, "\302\251" and a newline \n second line.') 
        a = Literal(u'A test with a newline \\n second line.') 
        #a = Literal(u'A test')
        b = from_n3(a.n3())
        self.assertEquals(a, b)

if __name__ == '__main__':
    unittest.main(defaultTest='test_suite')

@@ -63,18 +63,20 @@
 rt from_
-n3
+bits
 %0D%0A%0D%0A%0D%0Acl
@@ -127,289 +127,30 @@
 def 
-setUp(self):%0D%0A        self.graph = Graph()%0D%0A%0D%0A    def tearDown(self):%0D%0A        del self.graph%0D%0A%0D%0A    def __test_from_n3(self):%0D%0A        %22%22%22Test that from_n3 can handle unicode.%22%22%22%0D%0A        a = u'%22%5C302%5C251%22'%0D%0A        from_n3(a.encode(%22utf-8%22)) %0D%0A        #from_n3(a) %0D%0A%0D%0A    def test
+test_to_bits_from_bits
 _rou
@@ -165,24 +165,26 @@
 self):%0D%0A
+%0D%0A
         
 #a = Lit
@@ -167,33 +167,32 @@
 lf):%0D%0A%0D%0A        
-#
 a = Literal(u'A 
@@ -181,32 +181,34 @@
   a = Literal(u'
+''
 A test with a un
@@ -209,44 +209,42 @@
 h a 
-unicode character, %22%5C302%5C251%22
+%5C%5Cn (backslash n), %22%5Cu00a9%22 ,
  and 
-a 
 newl
@@ -254,121 +254,33 @@
  %5Cn 
-second line.') %0D%0A        a = Literal(u'A test with a newline %5C%5Cn second line.') %0D%0A        #a = Literal(u'A test
+and a second line.%0D%0A''
 ')
+ 
 %0D%0A  
@@ -298,15 +298,22 @@
 rom_
-n3(a.n3
+bits(a.to_bits
 ())%0D
@@ -348,16 +348,18 @@
 , b)%0D%0A%0D%0A
+%0D%0A
 if __nam

check in working tests