Mercurial > hg > WSGraph
changeset 30:2fe3933f8eca
Yay! we now haz failing tests
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 13 Dec 2012 18:11:52 -0800 |
parents | 2e4ed8e0a103 |
children | 5f14a4183bf2 |
files | tests/doctest.txt |
diffstat | 1 files changed, 32 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/doctest.txt Thu Dec 13 18:05:39 2012 -0800 +++ b/tests/doctest.txt Thu Dec 13 18:11:52 2012 -0800 @@ -5,3 +5,35 @@ >>> from wsgraph.model import MemoryCache +Make a graph: + + >>> graph = MemoryCache() + +The graph starts off empty: + + >>> graph() == {'nodes': {}, 'edges': {}} + True + >>> graph.nodes() + [] + >>> graph.edges() + [] + >>> graph.node('A') is None + True + >>> graph['A'] is None + True + >>> graph.edge('A', 'B') is None + True + >>> graph[('A', 'B')] is None + True + >>> 'A' in graph + False + >>> ('A', 'B') in graph + False + +Let's add stuff to it: + + >>> nodeA = {'hello': "is it me you're looking for?"} + >>> graph['A'] = nodeA + >>> graph.edge('A', 'B', foo='bar') + >>> 'A' in graph + True