import unittest

import rdflib


prefix_data = """
              @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
              @prefix : <http://www.example.com#> .

              <http://www.example.com#prefix> a rdf:class ."""

base_data = """
            @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
            @base <http://www.example.com#> .

            <http://www.example.com#base> a rdf:class .
            """


class TestBaseAllowsHash(unittest.TestCase):
    """
    GitHub Issue 379: https://github.com/RDFLib/rdflib/issues/379
    """
    def setUp(self):
        self.g = rdflib.Graph()

    def test_parse_successful_prefix_with_hash(self):
        """
        Test parse of '@prefix' namespace directive to allow a trailing hash '#', as is
        permitted for an IRIREF:
        http://www.w3.org/TR/2014/REC-turtle-20140225/#grammar-production-prefixID
        """
        self.g.parse(data=prefix_data, format='n3')
        #self.assertIsInstance(self.g.subjects().next(), rdflib.URIRef)

    def test_parse_successful_base_with_hash(self):
        """
        Test parse of '@base' namespace directive to allow a trailing hash '#', as is
        permitted for an '@prefix' since both allow an IRIREF:
        http://www.w3.org/TR/2014/REC-turtle-20140225/#grammar-production-base
        """
        self.g.parse(data=base_data, format='n3')
        #self.assertIsInstance(self.g.subjects().next(), rdflib.URIRef)

if __name__ == "__main__":
    unittest.main()
@@ -25,17 +25,16 @@
 rdflib%0A%0A
-%0A
 prefix_d
@@ -960,33 +960,32 @@
 t='n3')%0A        
-#
 self.assertIsIns
@@ -1394,17 +1394,16 @@
         
-#
 self.ass

check that the file parsed