Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion test/jsonld/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
assert plugin
assert serializer
assert parser
import json

__all__: List[str] = []
7 changes: 0 additions & 7 deletions test/jsonld/test_api.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
# -*- coding: UTF-8 -*-
from rdflib.parser import Parser
from rdflib.plugin import register
from rdflib.serializer import Serializer

register("json-ld", Parser, "rdflib.plugins.parsers.jsonld", "JsonLDParser")
register("json-ld", Serializer, "rdflib.plugins.serializers.jsonld", "JsonLDSerializer")

from rdflib import Graph, Literal, URIRef


Expand Down
7 changes: 1 addition & 6 deletions test/jsonld/test_named_graphs.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# -*- coding: UTF-8 -*-
from rdflib import *
from rdflib.parser import Parser
from rdflib.plugin import register

register("json-ld", Parser, "rdflib.plugins.parsers.jsonld", "JsonLDParser")
register("application/ld+json", Parser, "rdflib.plugins.parsers.jsonld", "JsonLDParser")
from rdflib import ConjunctiveGraph, Dataset, Graph, URIRef

data = """
{
Expand Down
2 changes: 1 addition & 1 deletion test/test_dataset/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def get_dataset(request):
else:
try:
os.remove(path)
except:
except Exception:
pass


Expand Down
2 changes: 1 addition & 1 deletion test/test_graph/test_graph_formula.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def checkFormulaStore(store="default", configString=None):
os.unlink(path)
else:
g.store.destroy(configString)
except:
except Exception:
g.close()
if store == "SQLite":
os.unlink(path)
Expand Down
3 changes: 0 additions & 3 deletions test/test_issues/test_issue492.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# test for https://github.com/RDFLib/rdflib/issues/492

#!/usr/bin/env python3

import rdflib


Expand Down
2 changes: 1 addition & 1 deletion test/test_issues/test_issue604.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from rdflib import *
from rdflib import RDF, BNode, Graph, Literal, Namespace
from rdflib.collection import Collection


Expand Down
2 changes: 1 addition & 1 deletion test/test_literal/test_term.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def isclose(a, b, rel_tol=1e-09, abs_tol=0.0):
if not case_passed:
try:
case_passed = isclose((case[1] + case[2].value), case[3].value)
except:
except Exception:
pass

if not case_passed:
Expand Down
4 changes: 2 additions & 2 deletions test/test_misc/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ def testEvents(self):
assert c2["bob"] == "uncle"
assert c3["bob"] == "uncle"
del c3["bob"]
assert ("bob" in c1) == False
assert ("bob" in c2) == False
assert ("bob" in c1) is False
assert ("bob" in c2) is False
8 changes: 4 additions & 4 deletions test/test_namespace/test_namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,10 @@ def test_expand_curie_exception_messages(self) -> None:
["curie", "expected_result"],
[
("ex:tarek", URIRef("urn:example:tarek")),
("ex:", URIRef(f"urn:example:")),
("ex:a", URIRef(f"urn:example:a")),
("ex:a:b", URIRef(f"urn:example:a:b")),
("ex:a:b:c", URIRef(f"urn:example:a:b:c")),
("ex:", URIRef("urn:example:")),
("ex:a", URIRef("urn:example:a")),
("ex:a:b", URIRef("urn:example:a:b")),
("ex:a:b:c", URIRef("urn:example:a:b:c")),
("ex", ValueError),
("em:tarek", ValueError),
("em:", ValueError),
Expand Down
6 changes: 2 additions & 4 deletions test/test_parsers/test_parser_hext.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import sys
from pathlib import Path

sys.path.append(str(Path(__file__).parent.parent.absolute()))
from rdflib import ConjunctiveGraph, Dataset, Literal
from rdflib.namespace import XSD

Expand Down Expand Up @@ -116,8 +114,8 @@ def test_roundtrip():
try:
cg = ConjunctiveGraph().parse(f, format="nt")
# print(cg.serialize(format="n3"))
except:
print(f"Skipping: could not NT parse")
except Exception:
print("Skipping: could not NT parse")
skipped += 1
skip = True
if not skip:
Expand Down
6 changes: 2 additions & 4 deletions test/test_parsers/test_swap_n3.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import os
from test.data import TEST_DATA_DIR

import pytest

maketrans = str.maketrans
from test.data import TEST_DATA_DIR

import rdflib

"""
Expand Down Expand Up @@ -116,7 +114,7 @@ def get_cases():
tfiles += files
for tfile in set(tfiles):
gname = tfile.split("/swap-n3/swap/test/")[1][:-3].translate(
maketrans("-/", "__")
str.maketrans("-/", "__")
)
e = Envelope(gname, tfile)
if gname in skiptests:
Expand Down
5 changes: 1 addition & 4 deletions test/test_serializers/test_serializer_hext.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import sys
from pathlib import Path

sys.path.append(str(Path(__file__).parent.parent.absolute()))
import json
from pathlib import Path

from rdflib import ConjunctiveGraph, Dataset, Graph

Expand Down
8 changes: 4 additions & 4 deletions test/test_sparql/test_datetime_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_dateTime_duration_subs():
f = io.StringIO(data)
graph.parse(f, format="n3")

## 1st Test Case
# 1st Test Case

result1 = graph.query(
"""
Expand Down Expand Up @@ -117,7 +117,7 @@ def test_dateTime_duration_subs():
eq_(list(result1)[0][0], expected[0])
eq_(list(result1)[1][0], expected[1])

## 2nd Test Case
# 2nd Test Case

result2 = graph.query(
"""
Expand Down Expand Up @@ -165,7 +165,7 @@ def test_dateTime_duration_add():
f = io.StringIO(data)
graph.parse(f, format="n3")

## 1st Test case
# 1st Test case

result1 = graph.query(
"""
Expand Down Expand Up @@ -198,7 +198,7 @@ def test_dateTime_duration_add():
eq_(list(result1)[0][0], expected[0])
eq_(list(result1)[1][0], expected[1])

## 2nd Test case
# 2nd Test case

result2 = graph.query(
"""
Expand Down
2 changes: 1 addition & 1 deletion test/test_store/test_store_sparqlupdatestore.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

try:
assert len(urlopen(HOST).read()) > 0
except:
except Exception:
pytest.skip(f"{HOST} is unavailable.", allow_module_level=True)


Expand Down
3 changes: 1 addition & 2 deletions test/test_turtle_quoting.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import itertools
import logging
import re
from typing import Callable, Dict, Iterable, List, Tuple

import pytest
Expand All @@ -28,8 +29,6 @@
"\\": "\\",
}

import re


def make_unquote_correctness_pairs() -> List[Tuple[str, str]]:
"""
Expand Down
2 changes: 1 addition & 1 deletion test/test_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def test_rdflib_query_exercise() -> None:
assert python_two == 2

python_true: bool = literal_true.toPython()
assert python_true == True
assert python_true is True

python_iri: str = kb_https_uriref.toPython()
assert python_iri == "https://example.org/kb/y"
6 changes: 3 additions & 3 deletions test/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,9 @@ def test_util_from_n3_not_escapes(self, string: str) -> None:
@pytest.mark.parametrize(
"string",
[
(f"j\\366rn"),
(f"\\"),
(f"\\0"),
("j\\366rn"),
("\\"),
("\\0"),
],
)
def test_util_from_n3_not_escapes_xf(self, string: str) -> None:
Expand Down
2 changes: 1 addition & 1 deletion test/test_w3c_spec/test_n3_w3c.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def n3(test: RDFTest):
res.serialize(),
)

except:
except Exception:
if test.syntax:
raise

Expand Down