Skip to content

Commit 1573dff

Browse files
committed
Merge pull request #23 from ProjetPP/fix-list-types
Fix list types w.r.t. the doc. Closes GH-22.
2 parents 313b57c + f7bafc4 commit 1573dff

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

ppp_datamodel/nodes/list_operators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ class ListNodeOperator(AbstractNode):
1515

1616
def _check_attributes(self, attributes):
1717
super(ListNodeOperator, self)._check_attributes(attributes)
18-
if not isinstance(attributes['list'], (List, Sort)):
18+
if not isinstance(attributes['list'], AbstractNode):
1919
raise TypeError('The “list” argument of the %s constructor '
20-
'should be a List or Sort node, not %r' %
20+
'should be a node, not %r' %
2121
(self.__class__.__name__, attributes['list']))
2222

2323
class ListOperator(AbstractNode):

tests/test_list_operators.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from unittest import TestCase
55

66
class ListOperatorTests(TestCase):
7-
def testIsListNode(self):
7+
def testListNodesType(self):
88
d1 = {"type": "sort", "predicate": {"type": "resource", "value": "foo"},
99
"list": [{"type": "resource", "value": "George Washington"},
1010
{"type": "resource", "value": "Theodore Roosevelt"}]}
@@ -13,6 +13,9 @@ def testIsListNode(self):
1313
"list": [{"type": "resource", "value": "George Washington"},
1414
{"type": "resource", "value": "Theodore Roosevelt"}]}
1515
AbstractNode.from_dict(d2)
16+
d3 = {"type": "sort", "predicate": {"type": "resource", "value": "foo"},
17+
"list": {"type": "resource", "value": "George Washington"}}
18+
AbstractNode.from_dict(d3)
1619
def testUnion(self):
1720
d1 = {"type": "union",
1821
"list": [{"type": "resource", "value": "George Washington"},

0 commit comments

Comments
 (0)