|
7 | 7 | from rdflib.term import Literal
|
8 | 8 |
|
9 | 9 |
|
10 |
| -__all__ = ['Collection'] |
| 10 | +__all__ = ["Collection"] |
11 | 11 |
|
12 | 12 |
|
13 | 13 | class Collection(object):
|
@@ -67,7 +67,7 @@ def n3(self):
|
67 | 67 | "2"^^<http://www.w3.org/2001/XMLSchema#integer>
|
68 | 68 | "3"^^<http://www.w3.org/2001/XMLSchema#integer> )
|
69 | 69 | """
|
70 |
| - return "( %s )" % (' '.join([i.n3() for i in self])) |
| 70 | + return "( %s )" % (" ".join([i.n3() for i in self])) |
71 | 71 |
|
72 | 72 | def _get_container(self, index):
|
73 | 73 | """Gets the first, rest holding node at index."""
|
@@ -103,8 +103,7 @@ def index(self, item):
|
103 | 103 | elif not newLink:
|
104 | 104 | raise Exception("Malformed RDF Collection: %s" % self.uri)
|
105 | 105 | else:
|
106 |
| - assert len(newLink) == 1, \ |
107 |
| - "Malformed RDF Collection: %s" % self.uri |
| 106 | + assert len(newLink) == 1, "Malformed RDF Collection: %s" % self.uri |
108 | 107 | listName = newLink[0]
|
109 | 108 |
|
110 | 109 | def __getitem__(self, key):
|
@@ -246,21 +245,22 @@ def clear(self):
|
246 | 245 |
|
247 | 246 | def test():
|
248 | 247 | import doctest
|
| 248 | + |
249 | 249 | doctest.testmod()
|
250 | 250 |
|
251 | 251 |
|
252 | 252 | if __name__ == "__main__":
|
253 | 253 | test()
|
254 | 254 |
|
255 | 255 | from rdflib import Graph
|
| 256 | + |
256 | 257 | g = Graph()
|
257 | 258 |
|
258 | 259 | c = Collection(g, BNode())
|
259 | 260 |
|
260 | 261 | assert len(c) == 0
|
261 | 262 |
|
262 |
| - c = Collection( |
263 |
| - g, BNode(), [Literal("1"), Literal("2"), Literal("3"), Literal("4")]) |
| 263 | + c = Collection(g, BNode(), [Literal("1"), Literal("2"), Literal("3"), Literal("4")]) |
264 | 264 |
|
265 | 265 | assert len(c) == 4
|
266 | 266 |
|
|
0 commit comments