Skip to content

Commit

Permalink
Add tests for Dataset parse return type as well
Browse files Browse the repository at this point in the history
  • Loading branch information
mielvds committed Aug 31, 2023
1 parent e29a112 commit 51b184f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/test_conjunctivegraph/test_conjunctive_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"""


import pytest

from io import StringIO

import pytest

from rdflib import ConjunctiveGraph, Graph
from rdflib.namespace import NamespaceManager
from rdflib.parser import StringInputSource
Expand Down
21 changes: 21 additions & 0 deletions test/test_dataset/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import shutil
import tempfile
from io import StringIO
from test.data import context1, likes, pizza, tarek
from test.utils.namespace import EGSCHEME

Expand All @@ -25,6 +26,9 @@

HOST = "http://localhost:3030"
DB = "/db/"
DATA = """
<http://example.org/record/1> a <http://xmlns.com/foaf/0.1/Document> .
"""

pluginstores = []

Expand Down Expand Up @@ -262,3 +266,20 @@ def test_subgraph_without_identifier() -> None:
) == ("genid", genid_prefix)

assert f"{subgraph.identifier}".startswith(genid_prefix)

def test_parse_return_type():
g = Dataset()
g.parse(data=DATA, format='turtle')
assert type(g) is Dataset

g = Dataset()
g = g.parse(data=DATA, format='turtle')
assert type(g) is Dataset

g = Dataset()
g.parse(source=StringIO(DATA), format='turtle')
assert type(g) is Dataset

g = Dataset()
g = g.parse(source=StringIO(DATA), format='turtle')
assert type(g) is Dataset

0 comments on commit 51b184f

Please sign in to comment.