summaryrefslogtreecommitdiff
path: root/test/test_tsvresults.py
blob: 3e746a6535ff3f9e85f0f4395a4647ed9efaab88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import unittest
from StringIO import StringIO
from rdflib.plugins.sparql.results.tsvresults import TSVResultParser


class TestTSVResults(unittest.TestCase):

    def test_empty_tsvresults_bindings(self):
        # check that optional bindings are ordered properly
        source = """?s\t?p\t?o
        \t<urn:p>\t<urn:o>
        <urn:s>\t\t<urn:o>
        <urn:s>\t<urn:p>\t"""

        parser = TSVResultParser()
        source = StringIO(source)
        result = parser.parse(source)

        for idx, row in enumerate(result):
            self.assertTrue(row[idx] is None)