Mercurial > hg > WSGraph
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 |
rev | line source |
---|---|
0 | 1 Test WSGraph |
26 | 2 ============ |
0 | 3 |
4 The obligatory imports: | |
5 | |
29 | 6 >>> from wsgraph.model import MemoryCache |
0 | 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 |