From 51b184fba9347131d143e44aa9397021d7cc013d Mon Sep 17 00:00:00 2001 From: Miel Vander Sande Date: Thu, 31 Aug 2023 11:02:45 +0200 Subject: [PATCH] Add tests for Dataset parse return type as well --- .../test_conjunctive_graph.py | 4 ++-- test/test_dataset/test_dataset.py | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/test/test_conjunctivegraph/test_conjunctive_graph.py b/test/test_conjunctivegraph/test_conjunctive_graph.py index 4da1325ae..5432a6bc6 100644 --- a/test/test_conjunctivegraph/test_conjunctive_graph.py +++ b/test/test_conjunctivegraph/test_conjunctive_graph.py @@ -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 diff --git a/test/test_dataset/test_dataset.py b/test/test_dataset/test_dataset.py index b45f8062c..df8d471ce 100644 --- a/test/test_dataset/test_dataset.py +++ b/test/test_dataset/test_dataset.py @@ -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 @@ -25,6 +26,9 @@ HOST = "http://localhost:3030" DB = "/db/" +DATA = """ + a . +""" pluginstores = [] @@ -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 \ No newline at end of file