<s> from urllib2 import URLError <EOL> try : <EOL> from Ft . Lib import UriException <EOL> except : <EOL> from urllib2 import URLError as UriException <EOL> import unittest <EOL> from rdflib import ConjunctiveGraph , URIRef <EOL> class SPARQLloadContextsTest ( unittest . TestCase ) : <EOL> def test_dSet_parsed_as_URL_raises_Exception ( self ) : <EOL> querystr = """<STR_LIT>""" <EOL> graph = ConjunctiveGraph ( ) <EOL> graph . get_context ( URIRef ( "<STR_LIT>" ) <EOL> ) . parse ( "<STR_LIT>" ) <EOL> self . assertRaises ( ( URLError , UriException ) , <EOL> graph . query , ( querystr ) , loadContexts = False ) <EOL> def test_dSet_parsed_as_context_returns_results ( self ) : <EOL> querystr = """<STR_LIT>""" <EOL> graph = ConjunctiveGraph ( ) <EOL> graph . get_context ( URIRef ( '<STR_LIT>' ) <EOL> ) . parse ( "<STR_LIT>" ) <EOL> r = graph . query ( querystr , loadContexts = True ) <EOL> self . assert_ ( len ( r . bindings ) is not <NUM_LIT:0> ) </s>
