Skip to content
Snippets Groups Projects

Main

1 file
+ 18
8
Compare changes
  • Side-by-side
  • Inline
@@ -21,20 +21,20 @@ class TestObjectCount(unittest.TestCase):
def runTest(self):
# Modules
self.assertCount(
"""SELECT DISTINCT ?mod WHERE {
?mod a :Module .
"""SELECT * WHERE {
?subj a :Module .
?mod :id ?id .
?mod :index ?index .
?mod :titre ?titre .
?subj :id ?id .
?subj :index ?index .
?subj :titre ?titre .
MINUS { ?mod a :SousPartie }
MINUS { ?subj a :SousPartie }
}""",
(9, 6, 9 + 6),
)
# SousParties
self.assertCount(
"""SELECT DISTINCT ?subj WHERE {
"""SELECT * WHERE {
?subj a :SousPartie .
?subj :id ?id .
@@ -45,7 +45,7 @@ class TestObjectCount(unittest.TestCase):
)
# Activités
self.assertCount(
"""SELECT DISTINCT ?subj WHERE {
"""SELECT * WHERE {
?subj a :Activite .
?subj :id ?id .
@@ -64,6 +64,16 @@ class TestObjectCount(unittest.TestCase):
"""
res = self.graph.query(query)
count = len(res)
# Check that variables bound to Literals are not empty or None
for binding in res.bindings:
for var, val in binding.items():
if isinstance(val, Literal):
self.assertFalse(
val.eq(Literal("")), f"Empty value: ?{var} = '{val}'"
)
self.assertFalse(
val.eq(Literal("None")), f"None value: ?{var} = '{val}'"
)
versions = ("macao_12", "macao_3", "full")
try:
Loading