<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Mu - 076continuation.cc</title> <meta name="Generator" content="Vim/8.0"> <meta name="plugin-version" content="vim7.4_v2"> <meta name="syntax" content="cpp"> <meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy="> <meta name="colorscheme" content="minimal-light"> <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #c6c6c6; } body { font-size:12pt; font-family: monospace; color: #000000; background-color: #c6c6c6; } a { color:inherit; } * { font-size:12pt; font-size: 1em; } .traceAbsent { color: #c00000; } .LineNr { } .Constant { color: #008787; } .muRecipe { color: #ff8700; } .Delimiter { color: #c000c0; } .Special { color: #d70000; } .Identifier { color: #af5f00; } .Normal { color: #000000; background-color: #c6c6c6; padding-bottom: 1px; } .Comment { color: #005faf; } .cSpecial { color: #008000; } .traceContains { color: #005f00; } --> </style> <script type='text/javascript'> <!-- /* function to open any folds containing a jumped-to line before jumping to it */ function JumpToLine() { var lineNum; lineNum = window.location.hash; lineNum = lineNum.substr(1); /* strip off '#' */ if (lineNum.indexOf('L') == -1) { lineNum = 'L'+lineNum; } lineElem = document.getElementById(lineNum); /* Always jump to new location even if the line was hidden inside a fold, or * we corrected the raw number to a line ID. */ if (lineElem) { lineElem.scrollIntoView(true); } return true; } if ('onhashchange' in window) { window.onhashchange = JumpToLine; } --> </script> </head> <body onload='JumpToLine();'> <a href='https://github.com/akkartik/mu/blob/master/076continuation.cc'>https://github.com/akkartik/mu/blob/master/076continuation.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Continuations are a powerful primitive for constructing advanced kinds of</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: control *policies* like back-tracking.</span> <span id="L3" class="LineNr"> 3 </span><span class="Comment">//:</span> <span id="L4" class="LineNr"> 4 </span><span class="Comment">//: In Mu, continuations are first-class and delimited, and are constructed</span> <span id="L5" class="LineNr"> 5 </span><span class="Comment">//: out of two primitives:</span> <span id="L6" class="LineNr"> 6 </span><span class="Comment">//:</span> <span id="L7" class="LineNr"> 7 </span><span class="Comment">//: * 'call-with-continuation-mark' marks the top of the call stack and then</span> <span id="L8" class="LineNr"> 8 </span><span class="Comment">//: calls the provided recipe.</span> <span id="L9" class="LineNr"> 9 </span><span class="Comment">//: * 'return-continuation-until-mark' copies the top of the stack</span> <span id="L10" class="LineNr"> 10 </span><span class="Comment">//: until the mark, and returns it as the result of</span> <span id="L11" class="LineNr"> 11 </span><span class="Comment">//: 'call-with-continuation-mark' (which might be a distant ancestor on the</span> <span id="L12" class="LineNr"> 12 </span><span class="Comment">//: call stack; intervening calls don't return)</span> <span id="L13" class="LineNr"> 13 </span><span class="Comment">//:</span> <span id="L14" class="LineNr"> 14 </span><span class="Comment">//: The resulting slice of the stack can now be called just like a regular</span> <span id="L15" class="LineNr"> 15 </span><span class="Comment">//: recipe.</span> <span id="L16" class="LineNr"> 16 </span><span class="Comment">//:</span> <span id="L17" class="LineNr"> 17 </span><span class="Comment">//: See the example programs continuation*.mu to get a sense for the</span> <span id="L18" class="LineNr"> 18 </span><span class="Comment">//: possibilities.</span> <span id="L19" class="LineNr"> 19 </span><span class="Comment">//:</span> <span id="L20" class="LineNr"> 20 </span><span class="Comment">//: Refinements:</span> <span id="L21" class="LineNr"> 21 </span><span class="Comment">//: * You can call a single continuation multiple times, and it will preserve</span> <span id="L22" class="LineNr"> 22 </span><span class="Comment">//: the state of its local variables at each stack frame between calls.</span> <span id="L23" class="LineNr"> 23 </span><span class="Comment">//: The stack frames of a continuation are not destroyed until the</span> <span id="L24" class="LineNr"> 24 </span><span class="Comment">//: continuation goes out of scope. See continuation2.mu.</span> <span id="L25" class="LineNr"> 25 </span><span class="Comment">//: * 'return-continuation-until-mark' doesn't consume the mark, so you can</span> <span id="L26" class="LineNr"> 26 </span><span class="Comment">//: return multiple continuations based on a single mark. In combination</span> <span id="L27" class="LineNr"> 27 </span><span class="Comment">//: with the fact that 'return-continuation-until-mark' can return from</span> <span id="L28" class="LineNr"> 28 </span><span class="Comment">//: regular calls, just as long as there was an earlier call to</span> <span id="L29" class="LineNr"> 29 </span><span class="Comment">//: 'call-with-continuation-mark', this gives us a way to create resumable</span> <span id="L30" class="LineNr"> 30 </span><span class="Comment">//: recipes. See continuation3.mu.</span> <span id="L31" class="LineNr"> 31 </span><span class="Comment">//: * 'return-continuation-until-mark' can take ingredients to return just</span> <span id="L32" class="LineNr"> 32 </span><span class="Comment">//: like other 'return' instructions. It just implicitly also returns a</span> <span id="L33" class="LineNr"> 33 </span><span class="Comment">//: continuation as the first result. See continuation4.mu.</span> <span id="L34" class="LineNr"> 34 </span><span class="Comment">//: * Conversely, you can pass ingredients to a continuation when calling it,</span> <span id="L35" class="LineNr"> 35 </span><span class="Comment">//: to make it available to products of 'return-continuation-until-mark'.</span> <span id="L36" class="LineNr"> 36 </span><span class="Comment">//: See continuation5.mu.</span> <span id="L37" class="LineNr"> 37 </span><span class="Comment">//: * There can be multiple continuation marks on the stack at once;</span> <span id="L38" class="LineNr"> 38 </span><span class="Comment">//: 'call-with-continuation-mark' and 'return-continuation-until-mark' both</span> <span id="L39" class="LineNr"> 39 </span><span class="Comment">//: need to pass in a tag to coordinate on the correct mark. This allows us</span> <span id="L40" class="LineNr"> 40 </span><span class="Comment">//: to save multiple continuations for different purposes (say if one is</span> <span id="L41" class="LineNr"> 41 </span><span class="Comment">//: for exceptions) with overlapping stack frames. See exception.mu.</span> <span id="L42" class="LineNr"> 42 </span><span class="Comment">//:</span> <span id="L43" class="LineNr"> 43 </span><span class="Comment">//: Inspired by James and Sabry, "Yield: Mainstream delimited continuations",</span> <span id="L44" class="LineNr"> 44 </span><span class="Comment">//: Workshop on the Theory and Practice of Delimited Continuations, 2011.</span> <span id="L45" class="LineNr"> 45 </span><span class="Comment">//: <a href="https://www.cs.indiana.edu/~sabry/papers/yield.pdf">https://www.cs.indiana.edu/~sabry/papers/yield.pdf</a></span> <span id="L46" class="LineNr"> 46 </span><span class="Comment">//:</span> <span id="L47" class="LineNr"> 47 </span><span class="Comment">//: Caveats:</span> <span id="L48" class="LineNr"> 48 </span><span class="Comment">//: * At the moment we can't statically type-check continuations. So we raise</span> <span id="L49" class="LineNr"> 49 </span><span class="Comment">//: runtime errors for a call that doesn't return a continuation when the</span> <span id="L50" class="LineNr"> 50 </span><span class="Comment">//: caller expects, or one that returns a continuation when the caller</span> <span id="L51" class="LineNr"> 51 </span><span class="Comment">//: doesn't expect it. This shouldn't cause memory corruption, though.</span> <span id="L52" class="LineNr"> 52 </span><span class="Comment">//: There should still be no way to lookup addresses that aren't allocated.</span> <span id="L53" class="LineNr"> 53 </span> <span id="L54" class="LineNr"> 54 </span><span class="Delimiter">:(before "End Mu Types Initialization")</span> <span id="L55" class="LineNr"> 55 </span><a href='010vm.cc.html#L125'>type_ordinal</a> continuation = <span class="Special">Type_ordinal</span>[<span class="Constant">"continuation"</span>] = <span class="Special">Next_type_ordinal</span>++<span class="Delimiter">;</span> <span id="L56" class="LineNr"> 56 </span><span class="Special">Type</span>[continuation]<span class="Delimiter">.</span>name = <span class="Constant">"continuation"</span><span class="Delimiter">;</span> <span id="L57" class="LineNr"> 57 </span> <span id="L58" class="LineNr"> 58 </span><span class="Comment">//: A continuation can be called like a recipe.</span> <span id="L59" class="LineNr"> 59 </span><span class="Delimiter">:(before "End <a href='072recipe.cc.html#L335'>is_mu_recipe</a> Atom Cases(r)")</span> <span id="L60" class="LineNr"> 60 </span><span class="Normal">if</span> <span class="Delimiter">(</span>r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>name == <span class="Constant">"continuation"</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L61" clas<style>pre { line-height: 125%; } td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */</style><div class="highlight"><pre><span></span><span class="cp"><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"></span> <span class="p"><</span><span class="nt">html</span><span class="p">><</span><span class="nt">head</span><span class="p">><</span><span class="nt">title</span><span class="p">></span>Python: module test.tc_bookmarks<span class="p"></</span><span class="nt">title</span><span class="p">></span> <span class="p"></</span><span class="nt">head</span><span class="p">><</span><span class="nt">body</span> <span class="na">bgcolor</span><span class="o">=</span><span class="s">"#f0f0f8"</span><span class="p">></span> <span class="p"><</span><span class="nt">table</span> <span class="na">width</span><span class="o">=</span><span class="s">"100%"</span> <span class="na">cellspacing</span><span class="o">=</span><span class="s">0</span> <span class="na">cellpadding</span><span class="o">=</span><span class="s">2</span> <span class="na">border</span><span class="o">=</span><span class="s">0</span> <span class="na">summary</span><span class="o">=</span><span class="s">"heading"</span><span class="p">></span> <span class="p"><</span><span class="nt">tr</span> <span class="na">bgcolor</span><span class="o">=</span><span class="s">"#7799ee"</span><span class="p">></span> <span class="p"><</span><span class="nt">td</span> <span class="na">valign</span><span class="o">=</span><span class="s">bottom</span><span class="p">></span><span class="ni">&nbsp;</span><span class="p"><</span><span class="nt">br</span><span class="p">></span> <span class="p"><</span><span class="nt">font</span> <span class="na">color</span><span class="o">=</span><span class="s">"#ffffff"</span> <span class="na">face</span><span class="o">=</span><span class="s">"helvetica, arial"</span><span class="p">></span><span class="ni">&nbsp;</span><span class="p"><</span><span class="nt">br</span><span class="p">><</span><span class="nt">big</span><span class="p">><</span><span class="nt">big</span><span class="p">><</span><span class="nt">strong</span><span class="p">><</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"test.html"</span><span class="p">><</span><span class="nt">font</span> <span class="na">color</span><span class="o">=</span><span class="s">"#ffffff"</span><span class="p">></span>test<span class="p"></</span><span class="nt">font</span><span class="p">></</span><span class="nt">a</span><span class="p">></span>.tc_bookmarks<span class="p"></</span><span class="nt">strong</span><span class="p">></</span><span class="nt">big</span><span class="p">></</span><span class="nt">big</span><span class="p">></</span><span class="nt">font</span><span class="p">></</span><span class="nt">td</span> <span class="p">><</span><span class="nt">td</span> <span class="na">align</span><span class="o">=</span><span class="s">right</span> <span class="na">valign</span><span class="o">=</span><span class="s">bottom</span> <span class="p">><</span><span class="nt">font</span> <span class="na">color</span><span class="o">=</span><span class="s">"#ffffff"</span> <span class="na">face</span><span class="o">=</span><span class="s">"helvetica, arial"</span><span class="p">><</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"."</span><span class="p">></span>index<span class="p"></</span><span class="nt">a</span><span class="p">><</span><span class="nt">br</span><span class="p">><</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"file:/home/hut/ranger/test/tc_bookmarks.py"</span><span class="p">></span>/home/hut/ranger/test/tc_bookmarks.py<span class="p"></</span><span class="nt">a</span><span class="p">></</span><span class="nt">font</span><span class="p">></</span><span class="nt">td</span><span class="p">></</span><span class="nt">tr</span><span class="p">></</span><span class="nt">table</span><span class="p">></span> <span class="p"><</span><span class="nt">p</span><span class="p">></</span><span class="nt">p</span><span class="p">></span> <span class="p"><</span><span class="nt">p</span><span class="p">></span> <span class="p"><</span><span class="nt">table</span> <span class="na">width</span><span class="o">=</span><span class="s">"100%"</span> <span class="na">cellspacing</span><span class="o">=</span><span class="s">0</span> <span class="na">cellpadding</span><span class="o">=</span><span class="s">2</span> <span class="na">border</span><span class="o">=</span><span class="s">0</span> <span class="na">summary</span><span class="o">=</span><span class="s">"section"</span><span class="p">></span> <span class="p"><</span><span class="nt">tr</span> <span class="na">bgcolor</span><span class="o">=</span><span class="s">"#aa55cc"</span><span class="p">></span> <span class="p"><</span><span class="nt">td</span> <span class="na">colspan</span><span class="o">=</span><span class="s">3</span> <span class="na">valign</span><span class="o">=</span><span class="s">bottom</span><span class="p">></span><span class="ni">&nbsp;</span><span class="p"><</span><span class="nt">br</span><span class="p">></span> <span class="p"><</span><span class="nt">font</span> <span class="na">color</span><span class="o">=</span><span class="s">"#ffffff"</span> <span class="na">face</span><span class="o">=</span><span class="s">"helvetica, arial"</span><span class="p">><</span><span class="nt">big</span><span class="p">><</span><span class="nt">strong</span><span class="p">></span>Modules<span class="p"></</span><span class="nt">strong</span><span class="p">></</span><span class="nt">big</span><span class="p">></</span><span class="nt">font</span><span class="p">></</span><span class="nt">td</span><span class="p">></</span><span class="nt">tr</span><span class="p">></span> <span class="p"><</span><span class="nt">tr</span><span class="p">><</span><span class="nt">td</span> <span class="na">bgcolor</span><span class="o">=</span><span class="s">"#aa55cc"</span><span class="p">><</span><span class="nt">tt</span><span class="p">></span><span class="ni">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="p"></</span><span class="nt">tt</span><span class="p">></</span><span class="nt">td</span><span class="p">><</span><span class="nt">td</span><span class="p">></span><span class="ni">&nbsp;</span><span class="p"></</span><span class="nt">td</span><span class="p">></span> <span class="p"><</span><span class="nt">td</span> <span class="na">width</span><span class="o">=</span><span class="s">"100%"</span><span class="p">><</span><span class="nt">table</span> <span class="na">width</span><span class="o">=</span><span class="s">"100%"</span> <span class="na">summary</span><span class="o">=</span><span class="s">"list"</span><span class="p">><</span><span class="nt">tr</span><span class="p">><</span><span class="nt">td</span> <span class="na">width</span><span class="o">=</span><span class="s">"25%"</span> <span class="na">valign</span><span class="o">=</span><span class="s">top</span><span class="p">><</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"os.html"</span><span class="p">></span>os<span class="p"></</span><span class="nt">a</span><span class="p">><</span><span class="nt">br</span><span class="p">></span> <span class="p"></</span><span class="nt">td</span><span class="p">><</span><span class="nt">td</span> <span class="na">width</span><span class="o">=</span><span class="s">"25%"</span> <span class="na">valign</span><span class="o">=</span><span class="s">top</span><span class="p">><</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"time.html"</span><span class="p">></span>time<span class="p"></</span><span class="nt">a</span><span class="p">><</span><span class="nt">br</span><span class="p">></span> <span class="p"></</span><span class="nt">td</span><span class="p">><</span><span class="nt">td</span> <span class="na">width</span><span class="o">=</span><span class="s">"25%"</span> <span class="na">valign</span><span class="o">=</span><span class="s">top</span><span class="p">><</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"unittest.html"</span><span class="p">></span>unittest<span class="p"></</span><span class="nt">a</span><span class="p">><</span><span class="nt">br</span><span class="p">></span> <span class="p"></</span><span class="nt">td</span><span class="p">><</span><span class="nt">td</span> <span class="na">width</span><span class="o">=</span><span class="s">"25%"</span> <span class="na">valign</span><span class="o">=</span><span class="s">top</span><span class="p">></</span><span class="nt">td</span><span class="p">></</span><span class="nt">tr</span><span class="p">></</span><span class="nt">table</span><span class="p">></</span><span class="nt">td</span><span class="p">></</span><span class="nt">tr</span><span class="p">></</span><span class="nt">table</span><span class="p">><</span><span class="nt">p</span><span class="p">></span> <span class="p"><</span><span class="nt">table</span> <span class="na">width</span><span class="o">=</span><span class="s">"100%"</span> <span class="na">cellspacing</span><span class="o">=</span><span class="s">0</span> <span class="na">cellpadding</span><span class="o">=</span><span class="s">2</span> <span class="na">border</span><span class="o">=</span><span class="s">0</span> <span class="na">summary</span><span class="o">=</span><span class="s">"section"</span><span class="p">></span> <span class="p"><</span><span class="nt">tr</span> <span class="na">bgcolor</span><span class="o">=</span><span class="s">"#ee77aa"</span><span class="p">></span> <span class="p"><</span><span class="nt">td</span> <span class="na">colspan</span><span class="o">=</span><span class="s">3</span> <span class="na">valign</span><span class="o">=</span><span class="s">bottom</span><span class="p">></span><span class="ni">&nbsp;</span><span class="p"><</span><span class="nt">br</span><span class="p">></span> <span class="p"><</span><span class="nt">font</span> <span class="na">color</span><span class="o">=</span><span class="s">"#ffffff"</span> <span class="na">face</span><span class="o">=</span><span class="s">"helvetica, arial"</span><span class="p">><</span><span class="nt">big</span><span class="p">><</span><span class="nt">strong</span><span class="p">></span>Classes<span class="p"></</span><span class="nt">strong</span><span class="p">></</span><span class="nt">big</span><span class="p">></</span><span class="nt">font</span><span class="p">></</span><span class="nt">td</span><span class="p">></</span><span class="nt">tr</span><span class="p">></span> <span class="p"><</span><span class="nt">tr</span><span class="p">><</span><span class="nt">td</span> <span class="na">bgcolor</span><span class="o">=</span><span class="s">"#ee77aa"</span><span class="p">><</span><span class="nt">tt</span><span class="p">></span><span class="ni">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="p"></</span><span class="nt">tt</span><span class="p">></</span><span class="nt">td</span><span class="p">><</span><span class="nt">td</span><span class="p">></span><span class="ni">&nbsp;</span><span class="p"></</span><span class="nt">td</span><span class="p">></span> <span class="p"><</span><span class="nt">td</span> <span class="na">width</span><span class="o">=</span><span class="s">"100%"</span><span class="p">><</span><span class="nt">dl</span><span class="p">></span> <span class="p"><</span><span class="nt">dt</span><span class="p">><</span><span class="nt">font</span> <span class="na">face</span><span class="o">=</span><span class="s">"helvetica, arial"</span><span class="p">><</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"unittest.html#TestCase"</span><span class="p">></span>unittest.TestCase<span class="p"></</span><span class="nt">a</span><span class="p">></span>(<span class="p"><</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"__builtin__.html#object"</span><span class="p">></span>__builtin__.object<span class="p"></</span><span class="nt">a</span><span class="p">></span>) <span class="p"></</span><span class="nt">font</span><span class="p">></</span><span class="nt">dt</span><span class="p">><</span><span class="nt">dd</span><span class="p">></span> <span class="p"><</span><span class="nt">dl</span><span class="p">></span> <span class="p"><</span><span class="nt">dt</span><span class="p">><</span><span class="nt">font</span> <span class="na">face</span><span class="o">=</span><span class="s">"helvetica, arial"</span><span class="p">><</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"test.tc_bookmarks.html#TestDisplayable"</span><span class="p">></span>TestDisplayable<span class="p"></</span><span class="nt">a</span><span class="p">></span> <span class="p"></</span><span class="nt">font</span><span class="p">></</span><span class="nt">dt</span><span class="p">></</span><span class="nt">dl</span><span class="p">></span> <span class="p"></</span><span class="nt">dd</span><span class="p">></span> <span class="p"></</span><span class="nt">dl</span><span class="p">></span> <span class="p"><</span><span class="nt">p</span><span class="p">></span> <span class="p"><</span><span class="nt">table</span> <span class="na">width</span><span class="o">=</span><span class="s">"100%"</span> <span class="na">cellspacing</span><span class="o">=</span><span class="s">0</span> <span class="na">cellpadding</span><span class="o">=</span><span class="s">2</span> <span class="na">border</span><span class="o">=</span><span class="s">0</span> <span class="na">summary</span><span class="o">=</span><span class="s">"section"</span><span class="p">></span> <span class="p"><</span><span class="nt">tr</span> <span class="na">bgcolor</span><span class="o">=</span><span class="s">"#ffc8d8"</span><span class="p">></span> <span class="p"><</span><span class="nt">td</span> <span class="na">colspan</span><span class="o">=</span><span class="s">3</span> <span class="na">valign</span><span class="o">=</span><span class="s">bottom</span><span class="p">></span><span class="ni">&nbsp;</span><span class="p"><</span><span class="nt">br</span><span class="p">></span> <span class="p"><</span><span class="nt">font</span> <span class="na">color</span><span class="o">=</span><span class="s">"#000000"</span> <span class="na">face</span><span class="o">=</span><span class="s">"helvetica, arial"</span><span class="p">><</span><span class="nt">a</span> <span class="na">name</span><span class="o">=</span><span class="s">"TestDisplayable"</span><span class="p">></span>class <span class="p"><</span><span class="nt">strong</span><span class="p">></span>TestDisplayable<span class="p"></</span><span class="nt">strong</span><span class="p">></</span><span class="nt">a</span><span class="p">></span>(<span class="p"><</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"unittest.html#TestCase"</span><span class="p">></span>unittest.TestCase<span class="p"></</span><span class="nt">a</span><span class="p">></span>)<span class="p"></</span><span class="nt">font</span><span class="p">></</span><span class="nt">td</span><span class="p">></</span><span class="nt">tr</span><span class="p">></span> <span class="p"><</span><span class="nt">tr</span><span class="p">><</span><span class="nt">td</span> <span class="na">bgcolor</span><span class="o">=</span><span class="s">"#ffc8d8"</span><span class="p">><</span><span class="nt">tt</span><span class="p">></span><span class="ni">&nbsp;&nbsp;&nbsp;</span><span class="p"></</span><span class="nt">tt</span><span class="p">></</span><span class="nt">td</span><span class="p">><</span><span class="nt">td</span><span class="p">></span><span class="ni">&nbsp;</span><span class="p"></</span><span class="nt">td</span><span class="p">></span> <span class="p"><</span><span class="nt">td</span> <span class="na">width</span><span class="o">=</span><span class="s">"100%"</span><span class="p">><</span><span class="nt">dl</span><span class="p">><</span><span class="nt">dt</span><span class="p">></span>Method resolution order:<span class="p"></</span><span class="nt">dt</span><span class="p">></span> <span class="p"><</span><span class="nt">dd</span><span class="p">><</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"test.tc_bookmarks.html#TestDisplayable"</span><span class="p">></span>TestDisplayable<span class="p"></</span><span class="nt">a</span><span class="p">></</span><span class="nt">dd</span><span class="p">></span> <span class="p"><</span><span class="nt">dd</span><span class="p">><</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"unittest.html#TestCase"</span><span class="p">></span>unittest.TestCase<span class="p"></</span><span class="nt">a</span><span class="p">></</span><span class="nt">dd</span><span class="p">></span> <span class="p"><</span><span class="nt">dd</span><span class="p">><</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"__builtin__.html#object"</span><span class="p">></span>__builtin__.object<span class="p"></</span><span class="nt">a</span><span class="p">></</span><span class="nt">dd</span><span class="p">></span> <span class="p"></</span><span class="nt">dl</span><span class="p">></span> <span class="p"><</span><span class="nt">hr</span><span class="p">></span> Methods defined here:<span class="p"><</span><span class="nt">br</span><span class="p">></span> <span class="p"><</span><span class="nt">dl</span><span class="p">><</span><span class="nt">dt</span><span class="p">><</span><span class="nt">a</span> <span class="na">name</span><span class="o">=</span><span class="s">"TestDisplayable-setUp"</span><span class="p">><</span><span class="nt">strong</span><span class="p">></span>setUp<span class="p"></</span><span class="nt">strong</span><span class="p">></</span><span class="nt">a</span><span class="p">></span>(self)<span class="p"></</span><span class="nt">dt</span><span class="p">></</span><span class="nt">dl</span><span class="p">></span> <span class="p"><</span><span class="nt">dl</span><span class="p">><</span><span class="nt">dt</span><span class="p">><</span><span class="nt">a</span> <span class="na">name</span><span class="o">=</span><span class="s">"TestDisplayable-tearDown"</span><span class="p">><</span><span class="nt">strong</span><span class="p">></span>tearDown<span class="p"></</span><span class="nt">strong</span><span class="p">></</span><span class="nt">a</span><span class="p">></span>(self)<span class="p"></</span><span class="nt">dt</span><span class="p">></</span><span class="nt">dl</span><span class="p">></span> <span class="p"><</span><span class="nt">dl</span><span class="p">><</span><span class="nt">dt</span><span class="p">><</span><span class="nt">a</span> <span class="na">name</span><span class="o">=</span><span class="s">"TestDisplayable-test_adding_bookmarks"</span><span class="p">><</span><span class="nt">strong</span><span class="p">></span>test_adding_bookmarks<span class="p"></</span><span class="nt">strong</span><span class="p">></</span><span class="nt">a</span><span class="p">></span>(self)<span class="p"></</span><span class="nt">dt</span><span class="p">></</span><span class="nt">dl</span><span class="p">></span> <span class="p"><</span><span class="nt">dl</span><span class="p">><</span><span class="nt">dt</span><span class="p">><</span><span class="nt">a</span> <span class="na">name</span><span class="o">=</span><span class="s">"TestDisplayable-test_messing_around"</span><span class="p">><</span><span class="nt">strong</span><span class="p">></span>test_messing_around<span class="p"></</span><span class="nt">strong</span><span class="p">></</span><span class="nt">a</span><span class="p">></span>(self)<span class="p"></</span><span class="nt">dt</span><span class="p">></</span><span class="nt">dl</span><span class="p">></span> <span class="p"><</span><span class="nt">dl</span><span class="p">><</span><span class="nt">dt</span><span class="p">><</span><span class="nt">a</span> <span class="na">name</span><span class="o">=</span><span class="s">"TestDisplayable-test_sharing_bookmarks_between_instances"</span><span class="p">><</span><span class="nt">strong</span><span class="p">></span>test_sharing_bookmarks_between_instances<span class="p"></</span><span class="nt">strong</span><span class="p">></</span><span class="nt">a</span><span class="p">></span>(self)<span class="p"></</span><span class="nt">dt</span><span class="p">></</span><span class="nt">dl</span><span class="p">></span> <span class="p"><</span><span class="nt">hr</span><span class="p">></span> Methods inherited from <span class="p"><</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"unittest.html#TestCase"</span><span class="p">></span>unittest.TestCase<span class="p"></</span><span class="nt">a</span><span class="p">></span>:<span class="p"><</span><span class="nt">br</span><span class="p">></span> <span class="p"><</span><span class="nt">dl</span><span class="p">><</span><span class="nt">dt</span><span class="p">><</span><span class="nt">a</span> <span class="na">name</span><span class="o">=</span><span class="s">"TestDisplayable-__call__"</span><span class="p">><</span><span class="nt">strong</span><span class="p">></span>__call__<span class="p"></</span><span class="nt">strong</span><span class="p">></</span><span class="nt">a</span><span class="p">></span>(self, *args, **kwds)<span class="p"></</span><span class="nt">dt</span><span class="p">></</span><span class="nt">dl</span><span class="p">></span> <span class="p"><</span><span class="nt">dl</span><span class="p">><</span><span class="nt">dt</span><span class="p">><</span><span class="nt">a</span> <span class="na">name</span><span class="o">=</span><span class="s">"TestDisplayable-__eq__"</span><span class="p">><</span><span class="nt">strong</span><span class="p">></span>__eq__<span class="p"></</span><span class="nt">strong</span><span class="p">></</span><span class="nt">a</span><span class="p">></span>(self, other)<span class="p"></</span><span class="nt">dt</span><span class="p">></</span><span class="nt">dl</span><span class="p">></span> <span class="p"><</span><span class="nt">dl</span><span class="p">><</span><span class="nt">dt</span><span class="p">><</span><span class="nt">a</span> <span class="na">name</span><span class="o">=</span><span class="s">"TestDisplayable-__hash__"</span><span class="p">><</span><span class="nt">strong</span><span class="p">></span>__hash__<span class="p"></</span><span class="nt">strong</span><span class="p">></</span><span class="nt">a</span><span class="p">></span>(self)<span class="p"></</span><span class="nt">dt</span><span class="p">></</span><span class="nt">dl</span><span class="p">></span> <span class="p"><</span><span class="nt">dl</span><span class="p">><</span><span class="nt">dt</span><span class="p">><</span><span class="nt">a</span> <span class="na">name</span><span class="o">=</span><span class="s">"TestDisplayable-__init__"</span><span class="p">><</span><span class="nt">strong</span><span class="p">></span>__init__<span class="p"></</span><span class="nt">strong</span><span class="p">></</span><span class="nt">a</span><span class="p">></span>(self, methodName<span class="p"><</span><span class="nt">font</span> <span class="na">color</span><span class="o">=</span><span class="s">"#909090"</span><span class="p">></span>='runTest'<span class="p"></</span><span class="nt">font</span><span class="p">></span>)<span class="p"></</span><span class="nt">dt</span><span class="p">><</span><span class="nt">dd</span><span class="p">><</span><span class="nt">tt</span><span class="p">></span>Create<span class="ni">&nbsp;</span>an<span class="ni">&nbsp;</span>instance<span class="ni">&nbsp;</span>of<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>class<span class="ni">&nbsp;</span>that<span class="ni">&nbsp;</span>will<span class="ni">&nbsp;</span>use<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>named<span class="ni">&nbsp;</span>test<span class="p"><</span><span class="nt">br</span><span class="p">></span> method<span class="ni">&nbsp;</span>when<span class="ni">&nbsp;</span>executed.<span class="ni">&nbsp;</span>Raises<span class="ni">&nbsp;</span>a<span class="ni">&nbsp;</span>ValueError<span class="ni">&nbsp;</span>if<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>instance<span class="ni">&nbsp;</span>does<span class="p"><</span><span class="nt">br</span><span class="p">></span> not<span class="ni">&nbsp;</span>have<span class="ni">&nbsp;</span>a<span class="ni">&nbsp;</span>method<span class="ni">&nbsp;</span>with<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>specified<span class="ni">&nbsp;</span>name.<span class="p"></</span><span class="nt">tt</span><span class="p">></</span><span class="nt">dd</span><span class="p">></</span><span class="nt">dl</span><span class="p">></span> <span class="p"><</span><span class="nt">dl</span><span class="p">><</span><span class="nt">dt</span><span class="p">><</span><span class="nt">a</span> <span class="na">name</span><span class="o">=</span><span class="s">"TestDisplayable-__ne__"</span><span class="p">><</span><span class="nt">strong</span><span class="p">></span>__ne__<span class="p"></</span><span class="nt">strong</span><span class="p">></</span><span class="nt">a</span><span class="p">></span>(self, other)<span class="p"></</span><span class="nt">dt</span><span class="p">></</span><span class="nt">dl</span><span class="p">></span> <span class="p"><</span><span class="nt">dl</span><span class="p">><</span><span class="nt">dt</span><span class="p">><</span><span class="nt">a</span> <span class="na">name</span><span class="o">=</span><span class="s">"TestDisplayable-__repr__"</span><span class="p">><</span><span class="nt">strong</span><span class="p">></span>__repr__<span class="p"></</span><span class="nt">strong</span><span class="p">></</span><span class="nt">a</span><span class="p">></span>(self)<span class="p"></</span><span class="nt">dt</span><span class="p">></</span><span class="nt">dl</span><span class="p">></span> <span class="p"><</span><span class="nt">dl</span><span class="p">><</span><span class="nt">dt</span><span class="p">><</span><span class="nt">a</span> <span class="na">name</span><span class="o">=</span><span class="s">"TestDisplayable-__str__"</span><span class="p">><</span><span class="nt">strong</span><span class="p">></span>__str__<span class="p"></</span><span class="nt">strong</span><span class="p">></</span><span class="nt">a</span><span class="p">></span>(self)<span class="p"></</span><span class="nt">dt</span><span class="p">></</span><span class="nt">dl</span><span class="p">></span> <span class="p"><</span><span class="nt">dl</span><span class="p">><</span><span class="nt">dt</span><span class="p">><</span><span class="nt">a</span> <span class="na">name</span><span class="o">=</span><span class="s">"TestDisplayable-assertAlmostEqual"</span><span class="p">><</span><span class="nt">strong</span><span class="p">></span>assertAlmostEqual<span class="p"></</span><span class="nt">strong</span><span class="p">></</span><span class="nt">a</span><span class="p">></span> = failUnlessAlmostEqual(self, first, second, places<span class="p"><</span><span class="nt">font</span> <span class="na">color</span><span class="o">=</span><span class="s">"#909090"</span><span class="p">></span>=7<span class="p"></</span><span class="nt">font</span><span class="p">></span>, msg<span class="p"><</span><span class="nt">font</span> <span class="na">color</span><span class="o">=</span><span class="s">"#909090"</span><span class="p">></span>=None<span class="p"></</span><span class="nt">font</span><span class="p">></span>)<span class="p"></</span><span class="nt">dt</span><span class="p">><</span><span class="nt">dd</span><span class="p">><</span><span class="nt">tt</span><span class="p">></span>Fail<span class="ni">&nbsp;</span>if<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>two<span class="ni">&nbsp;</span>objects<span class="ni">&nbsp;</span>are<span class="ni">&nbsp;</span>unequal<span class="ni">&nbsp;</span>as<span class="ni">&nbsp;</span>determined<span class="ni">&nbsp;</span>by<span class="ni">&nbsp;</span>their<span class="p"><</span><span class="nt">br</span><span class="p">></span> difference<span class="ni">&nbsp;</span>rounded<span class="ni">&nbsp;</span>to<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>given<span class="ni">&nbsp;</span>number<span class="ni">&nbsp;</span>of<span class="ni">&nbsp;</span>decimal<span class="ni">&nbsp;</span>places<span class="p"><</span><span class="nt">br</span><span class="p">></span> (default<span class="ni">&nbsp;</span>7)<span class="ni">&nbsp;</span>and<span class="ni">&nbsp;</span>comparing<span class="ni">&nbsp;</span>to<span class="ni">&nbsp;</span>zero.<span class="p"><</span><span class="nt">br</span><span class="p">></span> <span class="ni">&nbsp;</span><span class="p"><</span><span class="nt">br</span><span class="p">></span> Note<span class="ni">&nbsp;</span>that<span class="ni">&nbsp;</span>decimal<span class="ni">&nbsp;</span>places<span class="ni">&nbsp;</span>(from<span class="ni">&nbsp;</span>zero)<span class="ni">&nbsp;</span>are<span class="ni">&nbsp;</span>usually<span class="ni">&nbsp;</span>not<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>same<span class="p"><</span><span class="nt">br</span><span class="p">></span> as<span class="ni">&nbsp;</span>significant<span class="ni">&nbsp;</span>digits<span class="ni">&nbsp;</span>(measured<span class="ni">&nbsp;</span>from<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>most<span class="ni">&nbsp;</span>signficant<span class="ni">&nbsp;</span>digit).<span class="p"></</span><span class="nt">tt</span><span class="p">></</span><span class="nt">dd</span><span class="p">></</span><span class="nt">dl</span><span class="p">></span> <span class="p"><</span><span class="nt">dl</span><span class="p">><</span><span class="nt">dt</span><span class="p">><</span><span class="nt">a</span> <span class="na">name</span><span class="o">=</span><span class="s">"TestDisplayable-assertAlmostEquals"</span><span class="p">><</span><span class="nt">strong</span><span class="p">></span>assertAlmostEquals<span class="p"></</span><span class="nt">strong</span><span class="p">></</span><span class="nt">a</span><span class="p">></span> = failUnlessAlmostEqual(self, first, second, places<span class="p"><</span><span class="nt">font</span> <span class="na">color</span><span class="o">=</span><span class="s">"#909090"</span><span class="p">></span>=7<span class="p"></</span><span class="nt">font</span><span class="p">></span>, msg<span class="p"><</span><span class="nt">font</span> <span class="na">color</span><span class="o">=</span><span class="s">"#909090"</span><span class="p">></span>=None<span class="p"></</span><span class="nt">font</span><span class="p">></span>)<span class="p"></</span><span class="nt">dt</span><span class="p">><</span><span class="nt">dd</span><span class="p">><</span><span class="nt">tt</span><span class="p">></span>Fail<span class="ni">&nbsp;</span>if<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>two<span class="ni">&nbsp;</span>objects<span class="ni">&nbsp;</span>are<span class="ni">&nbsp;</span>unequal<span class="ni">&nbsp;</span>as<span class="ni">&nbsp;</span>determined<span class="ni">&nbsp;</span>by<span class="ni">&nbsp;</span>their<span class="p"><</span><span class="nt">br</span><span class="p">></span> difference<span class="ni">&nbsp;</span>rounded<span class="ni">&nbsp;</span>to<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>given<span class="ni">&nbsp;</span>number<span class="ni">&nbsp;</span>of<span class="ni">&nbsp;</span>decimal<span class="ni">&nbsp;</span>places<span class="p"><</span><span class="nt">br</span><span class="p">></span> (default<span class="ni">&nbsp;</span>7)<span class="ni">&nbsp;</span>and<span class="ni">&nbsp;</span>comparing<span class="ni">&nbsp;</span>to<span class="ni">&nbsp;</span>zero.<span class="p"><</span><span class="nt">br</span><span class="p">></span> <span class="ni">&nbsp;</span><span class="p"><</span><span class="nt">br</span><span class="p">></span> Note<span class="ni">&nbsp;</span>that<span class="ni">&nbsp;</span>decimal<span class="ni">&nbsp;</span>places<span class="ni">&nbsp;</span>(from<span class="ni">&nbsp;</span>zero)<span class="ni">&nbsp;</span>are<span class="ni">&nbsp;</span>usually<span class="ni">&nbsp;</span>not<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>same<span class="p"><</span><span class="nt">br</span><span class="p">></span> as<span class="ni">&nbsp;</span>significant<span class="ni">&nbsp;</span>digits<span class="ni">&nbsp;</span>(measured<span class="ni">&nbsp;</span>from<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>most<span class="ni">&nbsp;</span>signficant<span class="ni">&nbsp;</span>digit).<span class="p"></</span><span class="nt">tt</span><span class="p">></</span><span class="nt">dd</span><span class="p">></</span><span class="nt">dl</span><span class="p">></span> <span class="p"><</span><span class="nt">dl</span><span class="p">><</span><span class="nt">dt</span><span class="p">><</span><span class="nt">a</span> <span class="na">name</span><span class="o">=</span><span class="s">"TestDisplayable-assertEqual"</span><span class="p">><</span><span class="nt">strong</span><span class="p">></span>assertEqual<span class="p"></</span><span class="nt">strong</span><span class="p">></</span><span class="nt">a</span><span class="p">></span> = failUnlessEqual(self, first, second, msg<span class="p"><</span><span class="nt">font</span> <span class="na">color</span><span class="o">=</span><span class="s">"#909090"</span><span class="p">></span>=None<span class="p"></</span><span class="nt">font</span><span class="p">></span>)<span class="p"></</span><span class="nt">dt</span><span class="p">><</span><span class="nt">dd</span><span class="p">><</span><span class="nt">tt</span><span class="p">></span>Fail<span class="ni">&nbsp;</span>if<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>two<span class="ni">&nbsp;</span>objects<span class="ni">&nbsp;</span>are<span class="ni">&nbsp;</span>unequal<span class="ni">&nbsp;</span>as<span class="ni">&nbsp;</span>determined<span class="ni">&nbsp;</span>by<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>'=='<span class="p"><</span><span class="nt">br</span><span class="p">></span> operator.<span class="p"></</span><span class="nt">tt</span><span class="p">></</span><span class="nt">dd</span><span class="p">></</span><span class="nt">dl</span><span class="p">></span> <span class="p"><</span><span class="nt">dl</span><span class="p">><</span><span class="nt">dt</span><span class="p">><</span><span class="nt">a</span> <span class="na">name</span><span class="o">=</span><span class="s">"TestDisplayable-assertEquals"</span><span class="p">><</span><span class="nt">strong</span><span class="p">></span>assertEquals<span class="p"></</span><span class="nt">strong</span><span class="p">></</span><span class="nt">a</span><span class="p">></span> = failUnlessEqual(self, first, second, msg<span class="p"><</span><span class="nt">font</span> <span class="na">color</span><span class="o">=</span><span class="s">"#909090"</span><span class="p">></span>=None<span class="p"></</span><span class="nt">font</span><span class="p">></span>)<span class="p"></</span><span class="nt">dt</span><span class="p">><</span><span class="nt">dd</span><span class="p">><</span><span class="nt">tt</span><span class="p">></span>Fail<span class="ni">&nbsp;</span>if<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>two<span class="ni">&nbsp;</span>objects<span class="ni">&nbsp;</span>are<span class="ni">&nbsp;</span>unequal<span class="ni">&nbsp;</span>as<span class="ni">&nbsp;</span>determined<span class="ni">&nbsp;</span>by<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>'=='<span class="p"><</span><span class="nt">br</span><span class="p">></span> operator.<span class="p"></</span><span class="nt">tt</span><span class="p">></</span><span class="nt">dd</span><span class="p">></</span><span class="nt">dl</span><span class="p">></span> <span class="p"><</span><span class="nt">dl</span><span class="p">><</span><span class="nt">dt</span><span class="p">><</span><span class="nt">a</span> <span class="na">name</span><span class="o">=</span><span class="s">"TestDisplayable-assertFalse"</span><span class="p">><</span><span class="nt">strong</span><span class="p">></span>assertFalse<span class="p"></</span><span class="nt">strong</span><span class="p">></</span><span class="nt">a</span><span class="p">></span> = failIf(self, expr, msg<span class="p"><</span><span class="nt">font</span> <span class="na">color</span><span class="o">=</span><span class="s">"#909090"</span><span class="p">></span>=None<span class="p"></</span><span class="nt">font</span><span class="p">></span>)<span class="p"></</span><span class="nt">dt</span><span class="p">><</span><span class="nt">dd</span><span class="p">><</span><span class="nt">tt</span><span class="p">></span>Fail<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>test<span class="ni">&nbsp;</span>if<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>expression<span class="ni">&nbsp;</span>is<span class="ni">&nbsp;</span>true.<span class="p"></</span><span class="nt">tt</span><span class="p">></</span><span class="nt">dd</span><span class="p">></</span><span class="nt">dl</span><span class="p">></span> <span class="p"><</span><span class="nt">dl</span><span class="p">><</span><span class="nt">dt</span><span class="p">><</span><span class="nt">a</span> <span class="na">name</span><span class="o">=</span><span class="s">"TestDisplayable-assertNotAlmostEqual"</span><span class="p">><</span><span class="nt">strong</span><span class="p">></span>assertNotAlmostEqual<span class="p"></</span><span class="nt">strong</span><span class="p">></</span><span class="nt">a</span><span class="p">></span> = failIfAlmostEqual(self, first, second, places<span class="p"><</span><span class="nt">font</span> <span class="na">color</span><span class="o">=</span><span class="s">"#909090"</span><span class="p">></span>=7<span class="p"></</span><span class="nt">font</span><span class="p">></span>, msg<span class="p"><</span><span class="nt">font</span> <span class="na">color</span><span class="o">=</span><span class="s">"#909090"</span><span class="p">></span>=None<span class="p"></</span><span class="nt">font</span><span class="p">></span>)<span class="p"></</span><span class="nt">dt</span><span class="p">><</span><span class="nt">dd</span><span class="p">><</span><span class="nt">tt</span><span class="p">></span>Fail<span class="ni">&nbsp;</span>if<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>two<span class="ni">&nbsp;</span>objects<span class="ni">&nbsp;</span>are<span class="ni">&nbsp;</span>equal<span class="ni">&nbsp;</span>as<span class="ni">&nbsp;</span>determined<span class="ni">&nbsp;</span>by<span class="ni">&nbsp;</span>their<span class="p"><</span><span class="nt">br</span><span class="p">></span> difference<span class="ni">&nbsp;</span>rounded<span class="ni">&nbsp;</span>to<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>given<span class="ni">&nbsp;</span>number<span class="ni">&nbsp;</span>of<span class="ni">&nbsp;</span>decimal<span class="ni">&nbsp;</span>places<span class="p"><</span><span class="nt">br</span><span class="p">></span> (default<span class="ni">&nbsp;</span>7)<span class="ni">&nbsp;</span>and<span class="ni">&nbsp;</span>comparing<span class="ni">&nbsp;</span>to<span class="ni">&nbsp;</span>zero.<span class="p"><</span><span class="nt">br</span><span class="p">></span> <span class="ni">&nbsp;</span><span class="p"><</span><span class="nt">br</span><span class="p">></span> Note<span class="ni">&nbsp;</span>that<span class="ni">&nbsp;</span>decimal<span class="ni">&nbsp;</span>places<span class="ni">&nbsp;</span>(from<span class="ni">&nbsp;</span>zero)<span class="ni">&nbsp;</span>are<span class="ni">&nbsp;</span>usually<span class="ni">&nbsp;</span>not<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>same<span class="p"><</span><span class="nt">br</span><span class="p">></span> as<span class="ni">&nbsp;</span>significant<span class="ni">&nbsp;</span>digits<span class="ni">&nbsp;</span>(measured<span class="ni">&nbsp;</span>from<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>most<span class="ni">&nbsp;</span>signficant<span class="ni">&nbsp;</span>digit).<span class="p"></</span><span class="nt">tt</span><span class="p">></</span><span class="nt">dd</span><span class="p">></</span><span class="nt">dl</span><span class="p">></span> <span class="p"><</span><span class="nt">dl</span><span class="p">><</span><span class="nt">dt</span><span class="p">><</span><span class="nt">a</span> <span class="na">name</span><span class="o">=</span><span class="s">"TestDisplayable-assertNotAlmostEquals"</span><span class="p">><</span><span class="nt">strong</span><span class="p">></span>assertNotAlmostEquals<span class="p"></</span><span class="nt">strong</span><span class="p">></</span><span class="nt">a</span><span class="p">></span> = failIfAlmostEqual(self, first, second, places<span class="p"><</span><span class="nt">font</span> <span class="na">color</span><span class="o">=</span><span class="s">"#909090"</span><span class="p">></span>=7<span class="p"></</span><span class="nt">font</span><span class="p">></span>, msg<span class="p"><</span><span class="nt">font</span> <span class="na">color</span><span class="o">=</span><span class="s">"#909090"</span><span class="p">></span>=None<span class="p"></</span><span class="nt">font</span><span class="p">></span>)<span class="p"></</span><span class="nt">dt</span><span class="p">><</span><span class="nt">dd</span><span class="p">><</span><span class="nt">tt</span><span class="p">></span>Fail<span class="ni">&nbsp;</span>if<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>two<span class="ni">&nbsp;</span>objects<span class="ni">&nbsp;</span>are<span class="ni">&nbsp;</span>equal<span class="ni">&nbsp;</span>as<span class="ni">&nbsp;</span>determined<span class="ni">&nbsp;</span>by<span class="ni">&nbsp;</span>their<span class="p"><</span><span class="nt">br</span><span class="p">></span> difference<span class="ni">&nbsp;</span>rounded<span class="ni">&nbsp;</span>to<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>given<span class="ni">&nbsp;</span>number<span class="ni">&nbsp;</span>of<span class="ni">&nbsp;</span>decimal<span class="ni">&nbsp;</span>places<span class="p"><</span><span class="nt">br</span><span class="p">></span> (default<span class="ni">&nbsp;</span>7)<span class="ni">&nbsp;</span>and<span class="ni">&nbsp;</span>comparing<span class="ni">&nbsp;</span>to<span class="ni">&nbsp;</span>zero.<span class="p"><</span><span class="nt">br</span><span class="p">></span> <span class="ni">&nbsp;</span><span class="p"><</span><span class="nt">br</span><span class="p">></span> Note<span class="ni">&nbsp;</span>that<span class="ni">&nbsp;</span>decimal<span class="ni">&nbsp;</span>places<span class="ni">&nbsp;</span>(from<span class="ni">&nbsp;</span>zero)<span class="ni">&nbsp;</span>are<span class="ni">&nbsp;</span>usually<span class="ni">&nbsp;</span>not<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>same<span class="p"><</span><span class="nt">br</span><span class="p">></span> as<span class="ni">&nbsp;</span>significant<span class="ni">&nbsp;</span>digits<span class="ni">&nbsp;</span>(measured<span class="ni">&nbsp;</span>from<span class="ni">&nbsp;</span>the<span class="ni">&nbsp;</span>most<span class="ni">&nbsp;</span>signficant<span class="ni">&nbsp;</span>digit).<span class="p"></</span><span class="nt">tt</span><span class="p">></</span><span class="nt">dd</span><span class="p">></</span><span class="nt">dl</span><span class="p">></span> <span class="p"><</span><span class="nt">dl</span><span class="p">><</span><span class="nt">dt</span><span class="p">><</span><span class="nt">a</span> <span class="na">name</span><span