couple of sections of new-and-improved "unit testing" chapter

This commit is contained in:
Mark Pilgrim
2009-02-16 23:36:13 -05:00
parent 29129df299
commit 93849215bc
14 changed files with 765 additions and 527 deletions
+4 -4
View File
@@ -111,7 +111,7 @@ body{counter-reset:h1 2}
<li>Integers can be arbitrarily large.
</ol>
<blockquote class="note compare python2">
<p><span>&#x261E;</span>Python 2 had separate types for <code>int</code> and <code>long</code>. The <code>int</code> datatype was limited by <code>sys.maxint</code>, which varied by platform but was usually <code>2<sup>32</sup>-1</code>. Python 3 has just one integer type, which behaves mostly like the old <code>long</code> type from Python 2. See <a href=http://www.python.org/dev/peps/pep-0237>PEP 237</a> for details.
<p><span>&#x261E;</span>Python 2 had separate types for <code>int</code> and <code>long</code>. The <code>int</code> datatype was limited by <code>sys.maxint</code>, which varied by platform but was usually <code>2<sup>32</sup>-1</code>. Python 3 has just one integer type, which behaves mostly like the old <code>long</code> type from Python 2. See <a href=http://www.python.org/dev/peps/pep-0237><abbr>PEP</abbr> 237</a> for details.
</blockquote>
<p>You can do all kinds of things with numbers.
<pre class=screen>
@@ -137,7 +137,7 @@ body{counter-reset:h1 2}
<li>The <code>%</code> operator gives the remainder after performing integer division. <code>11</code> divided by <code>2</code> is <code>5</code> with a remainder of <code>1</code>, so the result here is <code>1</code>.
</ol>
<blockquote class="note compare python2">
<p><span>&#x261E;</span>In Python 2, the <code>/</code> operator usually meant integer division, but you could make it behave like floating point division by including a special directive in your code. In Python 3, the <code>/</code> operator always means floating point division. See <a href=http://www.python.org/dev/peps/pep-0238/>PEP 238</a> for details.
<p><span>&#x261E;</span>In Python 2, the <code>/</code> operator usually meant integer division, but you could make it behave like floating point division by including a special directive in your code. In Python 3, the <code>/</code> operator always means floating point division. See <a href=http://www.python.org/dev/peps/pep-0238/><abbr>PEP</abbr> 238</a> for details.
</blockquote>
<p>FIXME fractions, math module, numbers in a boolean context
<h2 id=lists>Lists</h2>
@@ -357,8 +357,8 @@ KeyError: 'db.diveintopython3.org'</samp></pre>
<ul>
<li>fractions
<li>math module
<li>PEP 237
<li>PEP 238
<li><abbr>PEP</abbr> 237
<li><abbr>PEP</abbr> 238
<li>links to appendix
<li>...etc...
</ul>