File: test_nt_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 (52 lines) | stat: -rw-r--r-- 1,361 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import os
import traceback
import logging

log = logging.getLogger(__name__)


"""
Basic code for loading all NT files in test/nt folder
The actual tests are done in test_roundtrip
"""


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


def all_nt_files():
    skiptests = [
        # illegal literal as subject
        "test/nt/literals-01.nt",
        "test/nt/keywords-08.nt",
        "test/nt/paths-04.nt",
        "test/nt/numeric-01.nt",
        "test/nt/numeric-02.nt",
        "test/nt/numeric-03.nt",
        "test/nt/numeric-04.nt",
        "test/nt/numeric-05.nt",
        # illegal variables
        "test/nt/formulae-01.nt",
        "test/nt/formulae-02.nt",
        "test/nt/formulae-03.nt",
        "test/nt/formulae-05.nt",
        "test/nt/formulae-06.nt",
        "test/nt/formulae-10.nt",
        # illegal bnode as predicate
        "test/nt/paths-06.nt",
        "test/nt/anons-02.nt",
        "test/nt/anons-03.nt",
        "test/nt/qname-01.nt",
        "test/nt/lists-06.nt",
    ]
    for fpath, fmt in _get_test_files_formats():
        if fpath in skiptests:
            log.debug("Skipping %s, known issue" % fpath)
        else:
            yield fpath, fmt