summaryrefslogtreecommitdiff
path: root/test/test_n3_suite.py
blob: bb7a96455d9c846d88625ec5b0274a0e14a13987 (plain)
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
import os
import sys

try:
    from testutils import check_serialize_parse
except:
    from test.testutils import check_serialize_parse

def _get_test_files_formats():
    skiptests = [
        'strquot.n3',
    ]
    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 test_n3_writing():
    for fpath, fmt in _get_test_files_formats():
        yield check_serialize_parse, fpath, fmt, 'n3'

if __name__ == "__main__":
    if len(sys.argv) > 1:
        check_serialize_parse(sys.argv[1], 'n3','n3', True)
        sys.exit()
    else:
        import nose
        nose.main(defaultTest=__name__)