-
Notifications
You must be signed in to change notification settings - Fork 560
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1057 from kushagr08/issue-910
fix #910: Updated evaluate.py so that union includes results of both branches, even when identical.
- Loading branch information
Showing
2 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
from rdflib import Graph | ||
import unittest | ||
|
||
|
||
class TestIssue910(unittest.TestCase): | ||
def testA(self): | ||
g = Graph() | ||
q = g.query( | ||
""" | ||
SELECT * { | ||
{ BIND ("a" AS ?a) } | ||
UNION | ||
{ BIND ("a" AS ?a) } | ||
} | ||
""" | ||
) | ||
self.assertEqual(len(q) == 2, True) | ||
|
||
def testB(self): | ||
g = Graph() | ||
q = g.query( | ||
""" | ||
SELECT * { | ||
{ BIND ("a" AS ?a) } | ||
UNION | ||
{ VALUES ?a { "a" } } | ||
UNION | ||
{ SELECT ("a" AS ?a) {} } | ||
} | ||
""" | ||
) | ||
self.assertEqual(len(q) == 3, True) | ||
|
||
def testC(self): | ||
g = Graph() | ||
q = g.query( | ||
""" | ||
SELECT * { | ||
{ BIND ("a" AS ?a) } | ||
UNION | ||
{ VALUES ?a { "a" } } | ||
UNION | ||
{ SELECT ("b" AS ?a) {} } | ||
} | ||
""" | ||
) | ||
self.assertEqual(len(q) == 3, True) | ||
|
||
def testD(self): | ||
g = Graph() | ||
q = g.query( | ||
"""SELECT * { | ||
{ BIND ("a" AS ?a) } | ||
UNION | ||
{ VALUES ?a { "b" } } | ||
UNION | ||
{ SELECT ("c" AS ?a) {} } | ||
} | ||
""" | ||
) | ||
self.assertEqual(len(q) == 3, True) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |