File: test_n3_suite.py

package info (click to toggle)
rdflib 6.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 38,248 kB
  • sloc: python: 39,216; sh: 153; makefile: 110
file content (38 lines) | stat: -rw-r--r-- 910 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import os
import logging

import pytest

log = logging.getLogger(__name__)

from .testutils import check_serialize_parse


def _get_test_files_formats():
    skiptests = []
    for f in os.listdir("test/n3"):
        if f not in skiptests:
            fpath = "test/n3/" + f
            if f.endswith(".rdf"):
                yield fpath, "xml"
            elif f.endswith(".n3"):
                yield fpath, "n3"


def all_n3_files():
    skiptests = [
        "test/n3/example-lots_of_graphs.n3",  # only n3 can serialize QuotedGraph, no point in testing roundtrip
    ]
    for fpath, fmt in _get_test_files_formats():
        if fpath in skiptests:
            log.debug("Skipping %s, known issue" % fpath)
        else:
            yield fpath, fmt


@pytest.mark.parametrize(
    "fpath,fmt",
    _get_test_files_formats(),
)
def test_n3_writing(fpath, fmt):
    check_serialize_parse(fpath, fmt, "n3")