Indeed, shame on me for not mentioning this.
I rarely have the full complement of externals available when I'm doing python 
work, and it struck me that this unitest was failing.
I suppose it should be possible to write unittests that test more than one 
particular implementation.

K

________________________________________
Frá: python-dev-bounces+kristjan=ccpgames....@python.org 
[python-dev-bounces+kristjan=ccpgames....@python.org] fyrir hönd Amaury 
Forgeot d'Arc [amaur...@gmail.com]
Sent: 21. júlí 2012 22:56
To: Antoine Pitrou
Cc: python-dev@python.org
Efni: Re: [Python-Dev] test_hashlib

2012/7/21 Antoine Pitrou <solip...@pitrou.net>:
> Kristján Valur Jónsson <krist...@ccpgames.com> wrote:
>>
>> The code will raise ValueError when int(1) is passed in, but the
>> unittests expect a TypeError.
>
> Well, if test_hashlib passes, surely your analysis is wrong, no?

In the normal case, yes:

>>> import hashlib
>>> hashlib.new(1)
TypeError: name must be a string

But if the _hashlib extension module is not available, the python
version is used and ValueError is raised:

>>> import sys
>>> sys.modules['_hashlib'] = None
>>> import hashlib
>>> hashlib.new(1)
ValueError: unsupported hash type 1

--
Amaury Forgeot d'Arc
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/kristjan%40ccpgames.com
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to