/usr/share/doc/python-manuel/html/bugs.html is in python-manuel 1.8.0-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Fixed Bugs — Manuel Documentation</title>
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Manuel Documentation" href="index.html" />
<link rel="prev" title="FIT Table Example" href="table-example.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head>
<body role="document">
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="fixed-bugs">
<h1>Fixed Bugs<a class="headerlink" href="#fixed-bugs" title="Permalink to this headline">¶</a></h1>
<p>Here are demonstrations of various bugs that have been fixed in Manuel. If you
encounter a bug in a previous version of Manuel, check here in the newest
version to see if your bug has been addressed.</p>
<div class="section" id="start-and-end-coinciding">
<h2>Start and End Coinciding<a class="headerlink" href="#start-and-end-coinciding" title="Permalink to this headline">¶</a></h2>
<p>If a line of text matches both a “start” and “end” regular expression, no
exception should be raised.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">source</span> <span class="o">=</span> <span class="s">"""</span><span class="se">\</span>
<span class="gp">... </span><span class="s">Blah, blah.</span>
<span class="gp">...</span><span class="s"></span>
<span class="gp">... </span><span class="s">xxx</span>
<span class="gp">... </span><span class="s">some text</span>
<span class="gp">... </span><span class="s">xxx</span>
<span class="gp">...</span><span class="s"></span>
<span class="gp">... </span><span class="s">"""</span>
<span class="gp">>>> </span><span class="kn">import</span> <span class="nn">manuel</span>
<span class="gp">>>> </span><span class="n">document</span> <span class="o">=</span> <span class="n">manuel</span><span class="o">.</span><span class="n">Document</span><span class="p">(</span><span class="n">source</span><span class="p">)</span>
<span class="gp">>>> </span><span class="kn">import</span> <span class="nn">re</span>
<span class="gp">>>> </span><span class="n">start</span> <span class="o">=</span> <span class="n">end</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="s">r'^xxx$'</span><span class="p">,</span> <span class="n">re</span><span class="o">.</span><span class="n">MULTILINE</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">document</span><span class="o">.</span><span class="n">find_regions</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">)</span>
<span class="go">[<manuel.Region object at ...]</span>
</pre></div>
</div>
</div>
<div class="section" id="code-block-options">
<h2>Code-block Options<a class="headerlink" href="#code-block-options" title="Permalink to this headline">¶</a></h2>
<p>The code-block handler didn’t originally allow reST options, so blocks like the
one below would generate a syntax error during parsing.</p>
<blockquote>
<div><div class="highlight-python"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2</pre></div></td><td class="code"><div class="highlight"><pre><span class="k">class</span> <span class="nc">Foo</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="k">pass</span>
</pre></div>
</td></tr></table></div>
</div></blockquote>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">manuel.codeblock</span>
<span class="n">m</span> <span class="o">=</span> <span class="n">manuel</span><span class="o">.</span><span class="n">codeblock</span><span class="o">.</span><span class="n">Manuel</span><span class="p">()</span>
<span class="n">manuel</span><span class="o">.</span><span class="n">Document</span><span class="p">(</span><span class="n">source</span><span class="p">)</span><span class="o">.</span><span class="n">parse_with</span><span class="p">(</span><span class="n">m</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="code-block-options-with-hyphens">
<h2>Code-block options with hyphens<a class="headerlink" href="#code-block-options-with-hyphens" title="Permalink to this headline">¶</a></h2>
<p>The code-block handler reST option parsing used to not allow for options with
hyphens in their name, so blocks like this one would generate a syntax error:</p>
<blockquote>
<div><pre class="code python literal-block">
<span class="ln">1 </span><span class="keyword">class</span> <span class="name class">Foo</span><span class="punctuation">(</span><span class="name builtin">object</span><span class="punctuation">):</span>
<span class="ln">2 </span> <span class="keyword">pass</span>
</pre>
</div></blockquote>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">manuel.codeblock</span>
<span class="n">m</span> <span class="o">=</span> <span class="n">manuel</span><span class="o">.</span><span class="n">codeblock</span><span class="o">.</span><span class="n">Manuel</span><span class="p">()</span>
<span class="n">manuel</span><span class="o">.</span><span class="n">Document</span><span class="p">(</span><span class="n">source</span><span class="p">)</span><span class="o">.</span><span class="n">parse_with</span><span class="p">(</span><span class="n">m</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="empty-documents">
<h2>Empty documents<a class="headerlink" href="#empty-documents" title="Permalink to this headline">¶</a></h2>
<p>While empty documents aren’t useful, they are still documents containing
no tests, and shouldn’t break the test suite.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">document</span> <span class="o">=</span> <span class="n">manuel</span><span class="o">.</span><span class="n">Document</span><span class="p">(</span><span class="s">''</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">document</span><span class="o">.</span><span class="n">source</span>
<span class="go">'\n'</span>
</pre></div>
</div>
</div>
<div class="section" id="glob-lifecycle">
<h2>Glob lifecycle<a class="headerlink" href="#glob-lifecycle" title="Permalink to this headline">¶</a></h2>
<p>Anything put into the globs during a doctest run should still be in there
afterward.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">a</span>
<span class="go">1</span>
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">b</span> <span class="o">=</span> <span class="mi">2</span>
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">manuel.doctest</span>
<span class="n">m</span> <span class="o">=</span> <span class="n">manuel</span><span class="o">.</span><span class="n">doctest</span><span class="o">.</span><span class="n">Manuel</span><span class="p">()</span>
<span class="n">globs</span> <span class="o">=</span> <span class="p">{</span><span class="s">'a'</span><span class="p">:</span> <span class="mi">1</span><span class="p">}</span>
<span class="n">document</span> <span class="o">=</span> <span class="n">manuel</span><span class="o">.</span><span class="n">Document</span><span class="p">(</span><span class="n">source</span><span class="p">)</span>
<span class="n">document</span><span class="o">.</span><span class="n">process_with</span><span class="p">(</span><span class="n">m</span><span class="p">,</span> <span class="n">globs</span><span class="o">=</span><span class="n">globs</span><span class="p">)</span>
</pre></div>
</div>
<p>The doctest in the <cite>source</cite> variable ran with no errors.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">six</span><span class="o">.</span><span class="n">print_</span><span class="p">(</span><span class="n">document</span><span class="o">.</span><span class="n">formatted</span><span class="p">())</span>
</pre></div>
</div>
<p>And now the globs dictionary reflects the changes made when the doctest ran.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">globs</span><span class="p">[</span><span class="s">'b'</span><span class="p">]</span>
<span class="go">2</span>
</pre></div>
</div>
</div>
<div class="section" id="zope-testing-module">
<h2>zope.testing.module<a class="headerlink" href="#zope-testing-module" title="Permalink to this headline">¶</a></h2>
<p>At one point, because of the way manuel.doctest handles glob dictionaries,
zope.testing.module didn’t work.</p>
<p>We need a globs dictionary.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">globs</span> <span class="o">=</span> <span class="p">{</span><span class="s">'foo'</span><span class="p">:</span> <span class="mi">1</span><span class="p">}</span>
</pre></div>
</div>
<p>To call the setUp and tearDown functions, we need to set up a fake test
object that uses our globs dict from above.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">FakeTest</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">globs</span> <span class="o">=</span> <span class="n">globs</span>
<span class="n">test</span> <span class="o">=</span> <span class="n">FakeTest</span><span class="p">()</span>
</pre></div>
</div>
<p>Now we will use the globs as a module.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">zope.testing.module</span>
<span class="gp">>>> </span><span class="n">zope</span><span class="o">.</span><span class="n">testing</span><span class="o">.</span><span class="n">module</span><span class="o">.</span><span class="n">setUp</span><span class="p">(</span><span class="n">test</span><span class="p">,</span> <span class="s">'fake'</span><span class="p">)</span>
</pre></div>
</div>
<p>Now if we run this test through Manuel, the fake module machinery works.</p>
<blockquote>
<div><p>The items put into the globs before the test are here.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">fake</span>
<span class="gp">>>> </span><span class="n">fake</span><span class="o">.</span><span class="n">foo</span>
<span class="go">1</span>
</pre></div>
</div>
<p>And if we create new bindings, they appear in the module too.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">bar</span> <span class="o">=</span> <span class="mi">2</span>
<span class="gp">>>> </span><span class="n">fake</span><span class="o">.</span><span class="n">bar</span>
<span class="go">2</span>
</pre></div>
</div>
</div></blockquote>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">manuel.doctest</span>
<span class="n">m</span> <span class="o">=</span> <span class="n">manuel</span><span class="o">.</span><span class="n">doctest</span><span class="o">.</span><span class="n">Manuel</span><span class="p">()</span>
<span class="n">document</span> <span class="o">=</span> <span class="n">manuel</span><span class="o">.</span><span class="n">Document</span><span class="p">(</span><span class="n">source</span><span class="p">)</span>
<span class="n">document</span><span class="o">.</span><span class="n">process_with</span><span class="p">(</span><span class="n">m</span><span class="p">,</span> <span class="n">globs</span><span class="o">=</span><span class="n">globs</span><span class="p">)</span>
</pre></div>
</div>
<p>The doctest in the <cite>source</cite> variable ran with no errors.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">six</span><span class="o">.</span><span class="n">print_</span><span class="p">(</span><span class="n">document</span><span class="o">.</span><span class="n">formatted</span><span class="p">())</span>
</pre></div>
</div>
<p>We should clean up now.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">zope.testing.module</span>
<span class="gp">>>> </span><span class="n">zope</span><span class="o">.</span><span class="n">testing</span><span class="o">.</span><span class="n">module</span><span class="o">.</span><span class="n">tearDown</span><span class="p">(</span><span class="n">test</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="debug-flag-and-adding-instances">
<h2>Debug flag and adding instances<a class="headerlink" href="#debug-flag-and-adding-instances" title="Permalink to this headline">¶</a></h2>
<p>The unittest integration (manuel.testing) sets the debug attribute on Manuel
objects. Manuel instances that result from adding instances together need to
have the debug value passed to each Manuel instances that was added together.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">m1</span> <span class="o">=</span> <span class="n">manuel</span><span class="o">.</span><span class="n">Manuel</span><span class="p">()</span>
<span class="gp">>>> </span><span class="n">m2</span> <span class="o">=</span> <span class="n">manuel</span><span class="o">.</span><span class="n">Manuel</span><span class="p">()</span>
</pre></div>
</div>
<p>The debug flag starts off false...</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">m1</span><span class="o">.</span><span class="n">debug</span>
<span class="go">False</span>
<span class="gp">>>> </span><span class="n">m2</span><span class="o">.</span><span class="n">debug</span>
<span class="go">False</span>
</pre></div>
</div>
<p>...but if we set it add the two instances together and set the flag on on the
resulting instance, the other one gets the value too.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">m3</span> <span class="o">=</span> <span class="n">m1</span> <span class="o">+</span> <span class="n">m2</span>
<span class="gp">>>> </span><span class="n">m3</span><span class="o">.</span><span class="n">debug</span> <span class="o">=</span> <span class="bp">True</span>
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">m1</span><span class="o">.</span><span class="n">debug</span>
<span class="go">True</span>
<span class="gp">>>> </span><span class="n">m2</span><span class="o">.</span><span class="n">debug</span>
<span class="go">True</span>
<span class="gp">>>> </span><span class="n">m3</span><span class="o">.</span><span class="n">debug</span>
<span class="go">True</span>
</pre></div>
</div>
</div>
<div class="section" id="testcase-id-methods">
<h2>TestCase id methods<a class="headerlink" href="#testcase-id-methods" title="Permalink to this headline">¶</a></h2>
<p>Twisted’s testrunner, trial, makes use of the id method of TestCase instances
in a way that requires it to be a meaningful string.</p>
<p>For manuel.testing.TestCase instances, this used to return None. As you can
see below, the manuel.testing.TestCase.shortDescription is now returned
instead:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">manuel.testing</span> <span class="kn">import</span> <span class="n">TestCase</span>
<span class="gp">>>> </span><span class="n">m</span> <span class="o">=</span> <span class="n">manuel</span><span class="o">.</span><span class="n">Manuel</span><span class="p">()</span>
<span class="gp">>>> </span><span class="n">six</span><span class="o">.</span><span class="n">print_</span><span class="p">(</span><span class="n">TestCase</span><span class="p">(</span><span class="n">m</span><span class="p">,</span> <span class="n">manuel</span><span class="o">.</span><span class="n">RegionContainer</span><span class="p">(),</span> <span class="bp">None</span><span class="p">)</span><span class="o">.</span><span class="n">id</span><span class="p">())</span>
<span class="go"><memory></span>
</pre></div>
</div>
</div>
<div class="section" id="doctestrunner-peaks-at-sys-argv">
<h2>DocTestRunner peaks at sys.argv<a class="headerlink" href="#doctestrunner-peaks-at-sys-argv" title="Permalink to this headline">¶</a></h2>
<p>A (bad) feature of DocTestRunner (and its subclass DebugRunner) is that it
will turn on “verbose” mode if sys.argv contains “-v”. This means that if you
pass -v to a test runner that then invokes Manuel, all tests would fail
because extra junk was inserted into the doctest output. That is, before I
fixed it. Now, manuel.doctest.Manuel passes “verbose = False” to the
DocTestRunner constructor which disables the functionality.</p>
<p>We can ensure that the verbose mode is always disabled by creating test
standins for DocTestRunner and DebugRunner that capture their constructor
arguments.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">doctest</span>
<span class="kn">import</span> <span class="nn">manuel.doctest</span>
<span class="k">class</span> <span class="nc">FauxDocTestRunner</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kws</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">kws</span> <span class="o">=</span> <span class="n">kws</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">manuel</span><span class="o">.</span><span class="n">doctest</span><span class="o">.</span><span class="n">DocTestRunner</span> <span class="o">=</span> <span class="n">FauxDocTestRunner</span>
<span class="n">manuel</span><span class="o">.</span><span class="n">doctest</span><span class="o">.</span><span class="n">DebugRunner</span> <span class="o">=</span> <span class="n">FauxDocTestRunner</span>
<span class="n">m</span> <span class="o">=</span> <span class="n">manuel</span><span class="o">.</span><span class="n">doctest</span><span class="o">.</span><span class="n">Manuel</span><span class="p">()</span>
<span class="k">finally</span><span class="p">:</span>
<span class="n">manuel</span><span class="o">.</span><span class="n">doctest</span><span class="o">.</span><span class="n">DocTestRunner</span> <span class="o">=</span> <span class="n">doctest</span><span class="o">.</span><span class="n">DocTestRunner</span>
<span class="n">manuel</span><span class="o">.</span><span class="n">doctest</span><span class="o">.</span><span class="n">DebugRunner</span> <span class="o">=</span> <span class="n">doctest</span><span class="o">.</span><span class="n">DebugRunner</span>
</pre></div>
</div>
<p>Now, with the Manuel object instantiated we can verify that verbose is off for
both test runners.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">m</span><span class="o">.</span><span class="n">runner</span><span class="o">.</span><span class="n">kws</span><span class="p">[</span><span class="s">'verbose'</span><span class="p">]</span>
<span class="go">False</span>
</pre></div>
</div>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">m</span><span class="o">.</span><span class="n">debug_runner</span><span class="o">.</span><span class="n">kws</span><span class="p">[</span><span class="s">'verbose'</span><span class="p">]</span>
<span class="go">False</span>
</pre></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Fixed Bugs</a><ul>
<li><a class="reference internal" href="#start-and-end-coinciding">Start and End Coinciding</a></li>
<li><a class="reference internal" href="#code-block-options">Code-block Options</a></li>
<li><a class="reference internal" href="#code-block-options-with-hyphens">Code-block options with hyphens</a></li>
<li><a class="reference internal" href="#empty-documents">Empty documents</a></li>
<li><a class="reference internal" href="#glob-lifecycle">Glob lifecycle</a></li>
<li><a class="reference internal" href="#zope-testing-module">zope.testing.module</a></li>
<li><a class="reference internal" href="#debug-flag-and-adding-instances">Debug flag and adding instances</a></li>
<li><a class="reference internal" href="#testcase-id-methods">TestCase id methods</a></li>
<li><a class="reference internal" href="#doctestrunner-peaks-at-sys-argv">DocTestRunner peaks at sys.argv</a></li>
</ul>
</li>
</ul>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
<li>Previous: <a href="table-example.html" title="previous chapter">FIT Table Example</a></li>
</ul></li>
</ul>
</div>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/bugs.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
©Benji York.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.6</a>
|
<a href="_sources/bugs.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>
|