diff options
author | Nicholas Car <nicholas.car@surroundaustralia.com> | 2020-05-25 11:06:47 +1000 |
---|---|---|
committer | Nicholas Car <nicholas.car@surroundaustralia.com> | 2020-05-25 11:06:47 +1000 |
commit | 2f6fca277e988462da989dfacffd41175b636832 (patch) | |
tree | 7a0418a2b97f6d16a40f0861d32e84367e0504df | |
parent | bf13a88e3124b702aed92f4fcc5ba4d0739d875a (diff) | |
download | rdflib-2f6fca277e988462da989dfacffd41175b636832.tar.gz |
fix for doctests
-rw-r--r-- | rdflib/container.py | 63 | ||||
-rw-r--r-- | requirements.dev.txt | 2 |
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 |