-
Notifications
You must be signed in to change notification settings - Fork 543
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1160 removed .defrag() and added a test
- Loading branch information
1 parent
65987a3
commit 7c7f05c
Showing
3 changed files
with
74 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,7 @@ def test_too_many_arguments(self): | |
source='a', | ||
location='b', | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import unittest | ||
from unittest import mock | ||
|
||
import rdflib | ||
|
||
from rdflib import ConjunctiveGraph | ||
from rdflib.parser import URLInputSource | ||
|
||
QUERY = ''' | ||
SELECT DISTINCT ?g | ||
FROM NAMED <http://ns.example.com/named#> | ||
WHERE { | ||
GRAPH ?g { | ||
?s ?p ?o . | ||
} | ||
} | ||
''' | ||
|
||
|
||
class NamedGraphWithFragmentTest(unittest.TestCase): | ||
def test_named_graph_with_fragment(self): | ||
"""Test that fragment part of the URL is not erased.""" | ||
graph = ConjunctiveGraph() | ||
|
||
with mock.patch('rdflib.parser.URLInputSource') as load_mock: | ||
# We have to expect an exception here. | ||
self.assertRaises(Exception, graph.query, QUERY) | ||
|
||
load_mock.assert_called_with( | ||
rdflib.URIRef('http://ns.example.com/named#'), | ||
'nt', | ||
) |