annotate tests/doctest.txt @ 31:5f14a4183bf2

fix things
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 13 Dec 2012 18:52:04 -0800
parents 2fe3933f8eca
children 943a4b7097af
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
cfcfa093e4b4 initial commit
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 Test WSGraph
26
60d7e38a20cd mostly notes to self
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
2 ============
0
cfcfa093e4b4 initial commit
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3
cfcfa093e4b4 initial commit
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 The obligatory imports:
cfcfa093e4b4 initial commit
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5
29
2e4ed8e0a103 passing pretend tests
Jeff Hammel <jhammel@mozilla.com>
parents: 26
diff changeset
6 >>> from wsgraph.model import MemoryCache
0
cfcfa093e4b4 initial commit
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7
30
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
8 Make a graph:
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
9
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
10 >>> graph = MemoryCache()
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
11
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
12 The graph starts off empty:
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
13
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
14 >>> graph() == {'nodes': {}, 'edges': {}}
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
15 True
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
16 >>> graph.nodes()
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
17 []
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
18 >>> graph.edges()
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
19 []
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
20 >>> graph.node('A') is None
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
21 True
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
22 >>> graph['A'] is None
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
23 True
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
24 >>> graph.edge('A', 'B') is None
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
25 True
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
26 >>> graph[('A', 'B')] is None
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
27 True
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
28 >>> 'A' in graph
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
29 False
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
30 >>> ('A', 'B') in graph
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
31 False
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
32
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
33 Let's add stuff to it:
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
34
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
35 >>> nodeA = {'hello': "is it me you're looking for?"}
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
36 >>> graph['A'] = nodeA
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
37 >>> graph.edge('A', 'B', foo='bar')
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
38 >>> 'A' in graph
2fe3933f8eca Yay! we now haz failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 29
diff changeset
39 True