Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 2, 2024
1 parent ef1a229 commit 78106bb
Show file tree
Hide file tree
Showing 101 changed files with 238 additions and 245 deletions.
6 changes: 3 additions & 3 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
pytest.register_assert_rewrite("test.utils")

from pathlib import Path
from test.utils.audit import AuditHookDispatcher
from test.utils.http import ctx_http_server
from test.utils.httpfileserver import HTTPFileServer
from typing import (
Collection,
Dict,
Expand All @@ -24,6 +21,9 @@
)

from rdflib import Graph
from test.utils.audit import AuditHookDispatcher
from test.utils.http import ctx_http_server
from test.utils.httpfileserver import HTTPFileServer

from .data import TEST_DATA_DIR
from .utils.earl import EARLReporter
Expand Down
2 changes: 1 addition & 1 deletion test/data.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pathlib import Path
from test.utils.graph import cached_graph

from rdflib import URIRef
from test.utils.graph import cached_graph

TEST_DIR = Path(__file__).parent
TEST_DATA_DIR = TEST_DIR / "data"
Expand Down
6 changes: 3 additions & 3 deletions test/data/suites/trix/test_trix.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

from __future__ import annotations

from test.data import TEST_DATA_DIR
from test.utils.manifest import RDFTest, read_manifest
from test.utils.namespace import RDFT
from typing import Callable, Dict

import pytest
Expand All @@ -14,6 +11,9 @@
from rdflib.compare import graph_diff, isomorphic
from rdflib.namespace import split_uri
from rdflib.term import Node, URIRef
from test.data import TEST_DATA_DIR
from test.utils.manifest import RDFTest, read_manifest
from test.utils.namespace import RDFT

verbose = False

Expand Down
3 changes: 1 addition & 2 deletions test/data/variants/diverse_quads.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from test.utils.namespace import EGDC, EGSCHEME, EGURN

from rdflib.graph import ConjunctiveGraph, Graph
from rdflib.namespace import XSD
from rdflib.term import Literal
from test.utils.namespace import EGDC, EGSCHEME, EGURN


def populate_graph(graph: Graph) -> None:
Expand Down
3 changes: 1 addition & 2 deletions test/data/variants/diverse_triples.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from test.utils.namespace import EGDC, EGSCHEME, EGURN

from rdflib.graph import Graph
from rdflib.term import Literal
from test.utils.namespace import EGDC, EGSCHEME, EGURN


def populate_graph(graph: Graph) -> None:
Expand Down
3 changes: 1 addition & 2 deletions test/data/variants/simple_quad.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from test.utils.namespace import EGDO

from rdflib.graph import ConjunctiveGraph, Graph
from test.utils.namespace import EGDO


def populate_graph(graph: Graph) -> None:
Expand Down
3 changes: 1 addition & 2 deletions test/data/variants/simple_triple.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from test.utils.namespace import EGDO

from rdflib.graph import Graph
from test.utils.namespace import EGDO


def populate_graph(graph: Graph) -> None:
Expand Down
3 changes: 1 addition & 2 deletions test/jsonld/test_nested_arrays.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from __future__ import annotations

from test.utils.namespace import EGDC

from rdflib import Graph, Literal
from rdflib.collection import Collection
from test.utils.namespace import EGDC

prop = EGDC["props/a"]
res = EGDC["res"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
from test.data import TEST_DATA_DIR

from rdflib import ConjunctiveGraph, URIRef
from test.data import TEST_DATA_DIR

timblcardn3 = open(os.path.join(TEST_DATA_DIR, "timbl-card.n3")).read()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
from test.data import CHEESE, LIKES, MICHEL, PIZZA, TAREK, TEST_DATA_DIR

from rdflib import ConjunctiveGraph, Graph
from test.data import CHEESE, LIKES, MICHEL, PIZZA, TAREK, TEST_DATA_DIR

sportquadstrig = open(os.path.join(TEST_DATA_DIR, "sportquads.trig")).read()

Expand Down
4 changes: 2 additions & 2 deletions test/test_dataset/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import shutil
import tempfile
import warnings
from test.data import CONTEXT1, LIKES, PIZZA, TAREK
from test.utils.namespace import EGSCHEME

import pytest

from rdflib import URIRef, plugin
from rdflib.graph import DATASET_DEFAULT_GRAPH_ID, Dataset, Graph
from rdflib.store import Store
from test.data import CONTEXT1, LIKES, PIZZA, TAREK
from test.utils.namespace import EGSCHEME

# Will also run SPARQLUpdateStore tests against local SPARQL1.1 endpoint if
# available. This assumes SPARQL1.1 query/update endpoints running locally at
Expand Down
2 changes: 1 addition & 1 deletion test/test_dataset/test_dataset_default_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import itertools
import logging
from test.data import TEST_DATA_DIR
from typing import Iterable, Type, Union

import pytest
from _pytest.mark.structures import ParameterSet

from rdflib.graph import DATASET_DEFAULT_GRAPH_ID, ConjunctiveGraph, Dataset
from rdflib.term import BNode, URIRef
from test.data import TEST_DATA_DIR


def make_load_default_and_named() -> Iterable[ParameterSet]:
Expand Down
2 changes: 1 addition & 1 deletion test/test_dataset/test_dataset_generators.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
from test.data import BOB, CHEESE, HATES, LIKES, MICHEL, PIZZA, TAREK, TEST_DATA_DIR

from rdflib import Dataset, URIRef
from test.data import BOB, CHEESE, HATES, LIKES, MICHEL, PIZZA, TAREK, TEST_DATA_DIR

timblcardn3 = open(os.path.join(TEST_DATA_DIR, "timbl-card.n3")).read()

Expand Down
3 changes: 1 addition & 2 deletions test/test_extras/test_infixowl/test_basic.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from test.data import CONTEXT0

import pytest

from rdflib import OWL, Graph, Literal, Namespace
Expand All @@ -12,6 +10,7 @@
max,
some,
)
from test.data import CONTEXT0

EXNS = Namespace("http://example.org/vocab/")

Expand Down
3 changes: 1 addition & 2 deletions test/test_extras/test_infixowl/test_class.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from test.data import CONTEXT0, CONTEXT1

import pytest

from rdflib import OWL, RDFS, BNode, Graph, Literal, Namespace, URIRef, Variable
Expand All @@ -12,6 +10,7 @@
max,
)
from rdflib.util import first
from test.data import CONTEXT0, CONTEXT1

EXNS = Namespace("http://example.org/vocab/")
PZNS = Namespace(
Expand Down
3 changes: 1 addition & 2 deletions test/test_extras/test_infixowl/test_cover.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from test.data import CONTEXT0, TEST_DATA_DIR

import pytest

from rdflib import OWL, RDF, RDFS, XSD, Graph, Literal, Namespace, URIRef, logger
Expand Down Expand Up @@ -28,6 +26,7 @@
some,
value,
)
from test.data import CONTEXT0, TEST_DATA_DIR

EXNS = Namespace("http://example.org/vocab/")
PZNS = Namespace(
Expand Down
3 changes: 1 addition & 2 deletions test/test_extras/test_infixowl/test_individual.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from test.data import CONTEXT0, PIZZA

import pytest

from rdflib import OWL, RDFS, BNode, Graph, Literal, Namespace, URIRef
from rdflib.extras.infixowl import Class, Individual
from test.data import CONTEXT0, PIZZA

EXNS = Namespace("http://example.org/vocab/")

Expand Down
3 changes: 1 addition & 2 deletions test/test_extras/test_infixowl/test_manchester_syntax.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from test.data import TEST_DATA_DIR

import pytest

from rdflib import OWL, RDFS, Graph, Literal, Namespace
from rdflib.extras.infixowl import Class, Individual, manchesterSyntax
from test.data import TEST_DATA_DIR

EXNS = Namespace("http://example.org/vocab/")
PZNS = Namespace(
Expand Down
2 changes: 1 addition & 1 deletion test/test_graph/test_canonicalization.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from collections import Counter
from io import StringIO
from test.utils import GraphHelper
from typing import TYPE_CHECKING, Set

import pytest
Expand All @@ -10,6 +9,7 @@
from rdflib.compare import to_canonical_graph, to_isomorphic
from rdflib.namespace import FOAF
from rdflib.plugins.stores.memory import Memory
from test.utils import GraphHelper

if TYPE_CHECKING:
from rdflib.graph import _TripleType
Expand Down
18 changes: 9 additions & 9 deletions test/test_graph/test_diff.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
from __future__ import annotations

from dataclasses import dataclass, field
from test.utils import (
COLLAPSED_BNODE,
BNodeHandling,
GHQuad,
GHTriple,
GraphHelper,
MarksType,
MarkType,
)
from typing import TYPE_CHECKING, Collection, Set, Tuple, Type, Union, cast

import pytest
Expand All @@ -21,6 +12,15 @@
from rdflib.graph import ConjunctiveGraph, Dataset
from rdflib.namespace import FOAF, RDF
from rdflib.term import BNode, Literal
from test.utils import (
COLLAPSED_BNODE,
BNodeHandling,
GHQuad,
GHTriple,
GraphHelper,
MarksType,
MarkType,
)

if TYPE_CHECKING:
from rdflib.graph import _TripleType
Expand Down
8 changes: 4 additions & 4 deletions test/test_graph/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
import logging
import os
from pathlib import Path
from test.data import BOB, CHEESE, HATES, LIKES, MICHEL, PIZZA, TAREK, TEST_DATA_DIR
from test.utils import GraphHelper, get_unique_plugin_names
from test.utils.httpfileserver import HTTPFileServer, ProtoFileResource
from test.utils.outcome import ExceptionChecker, OutcomeChecker, OutcomePrimitive
from typing import Callable, Optional, Set, Tuple
from urllib.error import HTTPError, URLError

Expand All @@ -18,6 +14,10 @@
from rdflib.plugin import PluginException
from rdflib.store import Store
from rdflib.term import BNode
from test.data import BOB, CHEESE, HATES, LIKES, MICHEL, PIZZA, TAREK, TEST_DATA_DIR
from test.utils import GraphHelper, get_unique_plugin_names
from test.utils.httpfileserver import HTTPFileServer, ProtoFileResource
from test.utils.outcome import ExceptionChecker, OutcomeChecker, OutcomePrimitive


def test_property_store() -> None:
Expand Down
5 changes: 2 additions & 3 deletions test/test_graph/test_graph_cbd.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
"""Tests the Graph class' cbd() function"""

from test.data import TEST_DATA_DIR
from test.utils import BNodeHandling, GraphHelper

import pytest

from rdflib import Graph, Namespace
from rdflib.namespace import RDF, RDFS
from rdflib.term import Literal, URIRef
from test.data import TEST_DATA_DIR
from test.utils import BNodeHandling, GraphHelper

EXAMPLE_GRAPH_FILE_PATH = TEST_DATA_DIR / "spec" / "cbd" / "example_graph.rdf"
EXAMPLE_GRAPH_CBD_FILE_PATH = TEST_DATA_DIR / "spec" / "cbd" / "example_graph_cbd.rdf"
Expand Down
2 changes: 1 addition & 1 deletion test/test_graph/test_graph_generators.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
from test.data import BOB, CHEESE, HATES, LIKES, MICHEL, PIZZA, TAREK, TEST_DATA_DIR

from rdflib import Graph
from test.data import BOB, CHEESE, HATES, LIKES, MICHEL, PIZZA, TAREK, TEST_DATA_DIR

timblcardn3 = open(os.path.join(TEST_DATA_DIR, "timbl-card.n3")).read()

Expand Down
10 changes: 5 additions & 5 deletions test/test_graph/test_graph_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
import logging
import re
from http.server import BaseHTTPRequestHandler
from urllib.error import HTTPError

import pytest

from rdflib import Graph
from test.data import TEST_DATA_DIR
from test.utils import GraphHelper
from test.utils.graph import cached_graph
Expand All @@ -16,11 +21,6 @@
from test.utils.httpservermock import ServedBaseHTTPServerMock
from test.utils.namespace import EGDO
from test.utils.wildcard import URL_PARSE_RESULT_WILDCARD
from urllib.error import HTTPError

import pytest

from rdflib import Graph

"""
Test that correct content negotiation headers are passed
Expand Down
8 changes: 4 additions & 4 deletions test/test_graph/test_graph_redirect.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from __future__ import annotations

from test.data import SIMPLE_TRIPLE_GRAPH, TEST_DATA_DIR
from test.utils import GraphHelper
from test.utils.http import MethodName, MockHTTPResponse
from test.utils.httpservermock import ServedBaseHTTPServerMock
from typing import Tuple
from urllib.parse import urlparse

from rdflib.graph import Graph
from test.data import SIMPLE_TRIPLE_GRAPH, TEST_DATA_DIR
from test.utils import GraphHelper
from test.utils.http import MethodName, MockHTTPResponse
from test.utils.httpservermock import ServedBaseHTTPServerMock


def test_graph_redirect_new_host(
Expand Down
2 changes: 1 addition & 1 deletion test/test_graph/test_graph_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import itertools
import logging
from test.data import SIMPLE_TRIPLE_GRAPH
from typing import (
TYPE_CHECKING,
Any,
Expand All @@ -32,6 +31,7 @@
from rdflib.query import Result
from rdflib.store import Store
from rdflib.term import Identifier, URIRef, Variable
from test.data import SIMPLE_TRIPLE_GRAPH

if TYPE_CHECKING:
from _pytest.mark.structures import ParameterSet
Expand Down
3 changes: 1 addition & 2 deletions test/test_graph/test_namespace_rebinding.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from test.data import CONTEXT1, CONTEXT2, TAREK

import pytest

from rdflib import ConjunctiveGraph, Graph, Literal
from rdflib.namespace import OWL, Namespace, NamespaceManager
from rdflib.plugins.stores.memory import Memory
from rdflib.term import URIRef
from test.data import CONTEXT1, CONTEXT2, TAREK

foaf1_uri = URIRef("http://xmlns.com/foaf/0.1/")
foaf2_uri = URIRef("http://xmlns.com/foaf/2.0/")
Expand Down
Loading

0 comments on commit 78106bb

Please sign in to comment.