summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Car <nicholas.car@surroundaustralia.com>2020-05-25 11:06:47 +1000
committerNicholas Car <nicholas.car@surroundaustralia.com>2020-05-25 11:06:47 +1000
commit2f6fca277e988462da989dfacffd41175b636832 (patch)
tree7a0418a2b97f6d16a40f0861d32e84367e0504df
parentbf13a88e3124b702aed92f4fcc5ba4d0739d875a (diff)
downloadrdflib-2f6fca277e988462da989dfacffd41175b636832.tar.gz
fix for doctests
-rw-r--r--rdflib/container.py63
-rw-r--r--requirements.dev.txt2
2 files changed, 38 insertions, 27 deletions
diff --git a/rdflib/container.py b/rdflib/container.py
index cca14024..e0e83843 100644
--- a/rdflib/container.py
+++ b/rdflib/container.py
@@ -7,33 +7,42 @@ __all__ = ["Container", "Bag", "Seq", "Alt", "NoElementException"]
class Container(object):
- """A class for constructing RDF containers, as per https://www.w3.org/TR/rdf11-mt/#rdf-containers"""
-
- __doc__ = """
- Basic usage, creating a ``Bag``:
-
- >>> from rdflib import Graph, BNode, Literal, Bag
- >>>
- >>> g = Graph()
- >>> b = Bag(g, BNode(), [Literal("One"), Literal("Two"), Literal("Three"))
- >>>
- >>> print(g.serialize(format="turtle").decode())
- ... @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
- ...
- ... [] a rdf:Bag ;
- ... rdf:_1 "One" ;
- ... rdf:_2 "Two" ;
- ... rdf:_3 "Three" .
-
- And getting an item from the ``Bag``:
-
- >>> print(b[2])
- ... Two
-
- And adding a new item:
-
- >>> b.append(Literal("100"))
-
+ """A class for constructing RDF containers, as per https://www.w3.org/TR/rdf11-mt/#rdf-containers
+
+ Basic usage, creating a ``Bag`` and adding to it::
+
+ >>> from rdflib import Graph, BNode, Literal, Bag
+
+ >>> g = Graph()
+ >>> b = Bag(g, BNode(), [Literal("One"), Literal("Two"), Literal("Three")])
+
+ >>> print(g.serialize(format="turtle").decode())
+
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+
+ [] a rdf:Bag ;
+ rdf:_1 "One" ;
+ rdf:_2 "Two" ;
+ rdf:_3 "Three" .
+
+ And getting an item from the ``Bag``:
+
+ >>> print(b[2])
+
+ Two
+
+ And adding a new item:
+
+ >>> b.append(Literal("Hello"))
+
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+
+ [] a rdf:Bag ;
+ rdf:_1 "One" ;
+ rdf:_2 "Two" ;
+ rdf:_3 "Three" .
+ rdf:_4 "Hello" .
+
"""
def __init__(self, graph, uri, seq=[], rtype="Bag"):
diff --git a/requirements.dev.txt b/requirements.dev.txt
new file mode 100644
index 00000000..58060d65
--- /dev/null
+++ b/requirements.dev.txt
@@ -0,0 +1,2 @@
+sphinx
+sphinxcontrib-apidoc