Hi Jeff,

On 27 May 2016 at 23:45, Jeff Doran <jdo...@lexmachina.com> wrote:
> The resulting strings comes from Cookie.__str__ I believe and the
> comparison in requests is a simple dict1 == dict2.

If what you're printing are two dicts, then they don't compare equal,
because of this value:

> 'NextGenCSO=8MWACYK5f24yllbpMwVpocfsyGYIBUXl4aWQvo7nUcWz2OwU7p4Dy40bxiyjGS5es8hBv5LxPT8PqBnWNzaBNo0k0PGffpQTDI4xBGc9WwQevnzyUCmq7WaXMTOTSpKM;
>  
> PacerClientCode=dev;PacerSession=8MWACYK5f24yllbpMwVpocfsyGYIBUXl4aWQvo7nUcWz2OwU7p4Dy40bxiyjGS5es8hBv5LxPT8PqBnWNzaBNo0k0PGffpQTDI4xBGc9WwQevnzyUCmq7WaXMTOTSpKM;
domain=.uscourts.gov; path=/; PacerPref="receipt=Y"'

which is just a long string, which is different from this other long
unicode string:

> u'PacerClientCode=dev; 
> path=/;NextGenCSO=8MWACYK5f24yllbpMwVpocfsyGYIBUXl4aWQvo7nUcWz2OwU7p4Dy40bxiyjGS5es8hBv5LxPT8PqBnWNzaBNo0k0PGffpQTDI4xBGc9WwQevnzyUCmq7WaXMTOTSpKM;domain=.uscourts.gov;PacerSession=8MWACYK5f24yllbpMwVpocfsyGYIBUXl4aWQvo7nUcWz2OwU7p4Dy40bxiyjGS5es8hBv5LxPT8PqBnWNzaBNo0k0PGffpQTDI4xBGc9WwQevnzyUCmq7WaXMTOTSpKM;PacerPref="receipt=Y"'

This is likely because the string was built following some dictionary
order, which is (in CPython) nondeterministic.  It is often roughly
stable, in that the same dictionaries often end up in the same order,
which is why such errors in the tests are not immediately apparent.
PyPy has a different order (which actually guarantees that dicts work
like OrderedDicts).

You should check that theory by verifying if your tests pass or break
with "python -R".  My guess is that they do not.  Then you can fix the
test---but maybe a better idea would be to fix the code to sort the
keys (I see that Cookie.py does sort the keys, so I'm guessing there
is more code involved here).


A bientôt,

Armin.
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to