comparison tests/doctest.txt @ 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 943a4b7097af
comparison
equal deleted inserted replaced
29:2e4ed8e0a103 30:2fe3933f8eca
3 3
4 The obligatory imports: 4 The obligatory imports:
5 5
6 >>> from wsgraph.model import MemoryCache 6 >>> from wsgraph.model import MemoryCache
7 7
8 Make a graph:
9
10 >>> graph = MemoryCache()
11
12 The graph starts off empty:
13
14 >>> graph() == {'nodes': {}, 'edges': {}}
15 True
16 >>> graph.nodes()
17 []
18 >>> graph.edges()
19 []
20 >>> graph.node('A') is None
21 True
22 >>> graph['A'] is None
23 True
24 >>> graph.edge('A', 'B') is None
25 True
26 >>> graph[('A', 'B')] is None
27 True
28 >>> 'A' in graph
29 False
30 >>> ('A', 'B') in graph
31 False
32
33 Let's add stuff to it:
34
35 >>> nodeA = {'hello': "is it me you're looking for?"}
36 >>> graph['A'] = nodeA
37 >>> graph.edge('A', 'B', foo='bar')
38 >>> 'A' in graph
39 True