changeset 34:16673636dcb6

wow, testing is fun!
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 13 Dec 2012 19:06:00 -0800
parents c880cf90f01d
children 52dedd2a8ffb
files tests/doctest.txt wsgraph/model.py
diffstat 2 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tests/doctest.txt	Thu Dec 13 19:00:30 2012 -0800
+++ b/tests/doctest.txt	Thu Dec 13 19:06:00 2012 -0800
@@ -37,3 +37,10 @@
     >>> graph.edge('A', 'B', dict(foo='bar'))
     >>> 'A' in graph
     True
+    >>> ['A', 'B'] in graph
+    True
+    >>> graph[('A', 'C')] =  {'why': "this will add 'C' to the graph"}
+    >>> 'C' in graph
+    True
+    >>> graph['C']
+    {}
--- a/wsgraph/model.py	Thu Dec 13 19:00:30 2012 -0800
+++ b/wsgraph/model.py	Thu Dec 13 19:06:00 2012 -0800
@@ -99,7 +99,7 @@
         else:
             # getter
             # TODO: deepcopy
-            return self._nodes.get(name, None)
+            return deepcopy(self._nodes.get(name, None))
 
     def nodes(self):
         return self._nodes.keys()
@@ -113,7 +113,7 @@
         else:
             # getter
             # TODO: deepcopy
-            return self._edges.get((node1, node2), None)
+            return deepcopy(self._edges.get((node1, node2), None))
 
     def edges(self):
         return self._edges.keys()