<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/cpython.git/Lib/test/test_cookie.py, branch v2.7</title>
<subtitle>
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/'/>
<entry>
<title>Replace catch_warnings with check_warnings when it makes sense.  Use assertRaises context manager to simplify some tests.</title>
<updated>2010-03-31T22:01:03+00:00</updated>
<author>
<name>Florent Xicluna</name>
<email>florent.xicluna@gmail.com</email>
</author>
<published>2010-03-31T22:01:03+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=6128d36bd3d99af7515c920b16323f192f1ccd90'/>
<id>6128d36bd3d99af7515c920b16323f192f1ccd90</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fixing the issue4860. Escaping embedded '"' character in js_output() method of Morsel.</title>
<updated>2009-04-02T03:00:34+00:00</updated>
<author>
<name>Senthil Kumaran</name>
<email>orsenthil@gmail.com</email>
</author>
<published>2009-04-02T03:00:34+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=fb84fb58a564269752978c89f31187dfdf7148ae'/>
<id>fb84fb58a564269752978c89f31187dfdf7148ae</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Convert test_cookie to unittest.</title>
<updated>2006-10-29T19:51:16+00:00</updated>
<author>
<name>Georg Brandl</name>
<email>georg@python.org</email>
</author>
<published>2006-10-29T19:51:16+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=4b6e8b54f72548ca78c58bd60bb8410c901f2fdc'/>
<id>4b6e8b54f72548ca78c58bd60bb8410c901f2fdc</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Correct test suite for #848017.</title>
<updated>2005-08-25T07:32:42+00:00</updated>
<author>
<name>Georg Brandl</name>
<email>georg@python.org</email>
</author>
<published>2005-08-25T07:32:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=dc885f76d4e7bb816ef2f07b33e9ca5d08f1252f'/>
<id>dc885f76d4e7bb816ef2f07b33e9ca5d08f1252f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Exercise sorted() where possible</title>
<updated>2004-01-04T11:14:51+00:00</updated>
<author>
<name>Raymond Hettinger</name>
<email>python@rcn.com</email>
</author>
<published>2004-01-04T11:14:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=fc6e2f8e8d08d6bb99596d8f1c3e040bc8de2d94'/>
<id>fc6e2f8e8d08d6bb99596d8f1c3e040bc8de2d94</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Suppress unsafe *Cookie class warnings</title>
<updated>2002-12-29T16:45:06+00:00</updated>
<author>
<name>Andrew M. Kuchling</name>
<email>amk@amk.ca</email>
</author>
<published>2002-12-29T16:45:06+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=1967c120824f328979ab48b4cad39ffed6b515fb'/>
<id>1967c120824f328979ab48b4cad39ffed6b515fb</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Get rid of relative imports in all unittests.  Now anything that</title>
<updated>2002-07-23T19:04:11+00:00</updated>
<author>
<name>Barry Warsaw</name>
<email>barry@python.org</email>
</author>
<published>2002-07-23T19:04:11+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=f2e8a66e10a6511d80081e7381c0378fa42e489f'/>
<id>f2e8a66e10a6511d80081e7381c0378fa42e489f</id>
<content type='text'>
imports e.g. test_support must do so using an absolute package name
such as "import test.test_support" or "from test import test_support".

This also updates the README in Lib/test, and gets rid of the
duplicate data dirctory in Lib/test/data (replaced by
Lib/email/test/data).

Now Tim and Jack can have at it. :)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
imports e.g. test_support must do so using an absolute package name
such as "import test.test_support" or "from test import test_support".

This also updates the README in Lib/test, and gets rid of the
duplicate data dirctory in Lib/test/data (replaced by
Lib/email/test/data).

Now Tim and Jack can have at it. :)
</pre>
</div>
</content>
</entry>
<entry>
<title>Teach regrtest how to pass on doctest failure msgs.  This is done via a</title>
<updated>2001-09-09T06:12:01+00:00</updated>
<author>
<name>Tim Peters</name>
<email>tim.peters@gmail.com</email>
</author>
<published>2001-09-09T06:12:01+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=df1391d52f873ea384befc007807b9d2f6a67439'/>
<id>df1391d52f873ea384befc007807b9d2f6a67439</id>
<content type='text'>
horridly inefficient hack in regrtest's Compare class, but it's about as
clean as can be:  regrtest has to set up the Compare instance before
importing a test module, and by the time the module *is* imported it's too
late to change that decision.  The good news is that the more tests we
convert to unittest and doctest, the less the inefficiency here matters.
Even now there are few tests with large expected-output files (the new
cost here is a Python-level call per .write() when there's an expected-
output file).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
horridly inefficient hack in regrtest's Compare class, but it's about as
clean as can be:  regrtest has to set up the Compare instance before
importing a test module, and by the time the module *is* imported it's too
late to change that decision.  The good news is that the more tests we
convert to unittest and doctest, the less the inefficiency here matters.
Even now there are few tests with large expected-output files (the new
cost here is a Python-level call per .write() when there's an expected-
output file).
</pre>
</div>
</content>
</entry>
<entry>
<title>Get rid of the superstitious "~" in dict hashing's "i = (~hash) &amp; mask".</title>
<updated>2001-05-13T00:19:31+00:00</updated>
<author>
<name>Tim Peters</name>
<email>tim.peters@gmail.com</email>
</author>
<published>2001-05-13T00:19:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=5770625e8863ea01ff84282611038197d3577fbf'/>
<id>5770625e8863ea01ff84282611038197d3577fbf</id>
<content type='text'>
The comment following used to say:
	/* We use ~hash instead of hash, as degenerate hash functions, such
	   as for ints &lt;sigh&gt;, can have lots of leading zeros. It's not
	   really a performance risk, but better safe than sorry.
	   12-Dec-00 tim:  so ~hash produces lots of leading ones instead --
	   what's the gain? */
That is, there was never a good reason for doing it.  And to the contrary,
as explained on Python-Dev last December, it tended to make the *sum*
(i + incr) &amp; mask (which is the first table index examined in case of
collison) the same "too often" across distinct hashes.

Changing to the simpler "i = hash &amp; mask" reduced the number of string-dict
collisions (== # number of times we go around the lookup for-loop) from about
6 million to 5 million during a full run of the test suite (these are
approximate because the test suite does some random stuff from run to run).
The number of collisions in non-string dicts also decreased, but not as
dramatically.

Note that this may, for a given dict, change the order (wrt previous
releases) of entries exposed by .keys(), .values() and .items().  A number
of std tests suffered bogus failures as a result.  For dicts keyed by
small ints, or (less so) by characters, the order is much more likely to be
in increasing order of key now; e.g.,

&gt;&gt;&gt; d = {}
&gt;&gt;&gt; for i in range(10):
...    d[i] = i
...
&gt;&gt;&gt; d
{0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9}
&gt;&gt;&gt;

Unfortunately. people may latch on to that in small examples and draw a
bogus conclusion.

test_support.py
    Moved test_extcall's sortdict() into test_support, made it stronger,
    and imported sortdict into other std tests that needed it.
test_unicode.py
    Excluced cp875 from the "roundtrip over range(128)" test, because
    cp875 doesn't have a well-defined inverse for unicode("?", "cp875").
    See Python-Dev for excruciating details.
Cookie.py
    Chaged various output functions to sort dicts before building
    strings from them.
test_extcall
    Fiddled the expected-result file.  This remains sensitive to native
    dict ordering, because, e.g., if there are multiple errors in a
    keyword-arg dict (and test_extcall sets up many cases like that), the
    specific error Python complains about first depends on native dict
    ordering.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The comment following used to say:
	/* We use ~hash instead of hash, as degenerate hash functions, such
	   as for ints &lt;sigh&gt;, can have lots of leading zeros. It's not
	   really a performance risk, but better safe than sorry.
	   12-Dec-00 tim:  so ~hash produces lots of leading ones instead --
	   what's the gain? */
That is, there was never a good reason for doing it.  And to the contrary,
as explained on Python-Dev last December, it tended to make the *sum*
(i + incr) &amp; mask (which is the first table index examined in case of
collison) the same "too often" across distinct hashes.

Changing to the simpler "i = hash &amp; mask" reduced the number of string-dict
collisions (== # number of times we go around the lookup for-loop) from about
6 million to 5 million during a full run of the test suite (these are
approximate because the test suite does some random stuff from run to run).
The number of collisions in non-string dicts also decreased, but not as
dramatically.

Note that this may, for a given dict, change the order (wrt previous
releases) of entries exposed by .keys(), .values() and .items().  A number
of std tests suffered bogus failures as a result.  For dicts keyed by
small ints, or (less so) by characters, the order is much more likely to be
in increasing order of key now; e.g.,

&gt;&gt;&gt; d = {}
&gt;&gt;&gt; for i in range(10):
...    d[i] = i
...
&gt;&gt;&gt; d
{0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9}
&gt;&gt;&gt;

Unfortunately. people may latch on to that in small examples and draw a
bogus conclusion.

test_support.py
    Moved test_extcall's sortdict() into test_support, made it stronger,
    and imported sortdict into other std tests that needed it.
test_unicode.py
    Excluced cp875 from the "roundtrip over range(128)" test, because
    cp875 doesn't have a well-defined inverse for unicode("?", "cp875").
    See Python-Dev for excruciating details.
Cookie.py
    Chaged various output functions to sort dicts before building
    strings from them.
test_extcall
    Fiddled the expected-result file.  This remains sensitive to native
    dict ordering, because, e.g., if there are multiple errors in a
    keyword-arg dict (and test_extcall sets up many cases like that), the
    specific error Python complains about first depends on native dict
    ordering.
</pre>
</div>
</content>
</entry>
<entry>
<title>Since Guido fiddled Cookie.py to work with doctest, it's a Good Thing to</title>
<updated>2001-04-06T21:20:58+00:00</updated>
<author>
<name>Tim Peters</name>
<email>tim.peters@gmail.com</email>
</author>
<published>2001-04-06T21:20:58+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=d4f5aeedfb87f2dcd72b45539b8ff690e5c85d07'/>
<id>d4f5aeedfb87f2dcd72b45539b8ff690e5c85d07</id>
<content type='text'>
have the std test suite exercise the Cookie doctests too.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
have the std test suite exercise the Cookie doctests too.
</pre>
</div>
</content>
</entry>
</feed>
