[Biopython-dev] [Bug 2651] Error from test_GAQueens.py

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Tue Nov 11 10:10:45 UTC 2008


http://bugzilla.open-bio.org/show_bug.cgi?id=2651





------- Comment #3 from biopython-bugzilla at maubp.freeserve.co.uk  2008-11-11 05:10 EST -------
(In reply to comment #2)
>(In reply to comment #1)
>> What bug in Seq?  Trying to call the count method with an integer argument
>> instead of string or another Seq should fail - try it on a string for
>> comparison:
>> 
>> >>> "123456".count(1)
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in ?
>> TypeError: expected a character buffer object
>> 
>> I would agree that the TypeError message could be better, "object of type
>> 'int' has no len()" is a little misleading.  Are you suggesting that be
>> changed?
> 
> That is an 'obvious' bug (in light of the error) because there is no check for
> that 'sub' is a string. Using the example from the docstring:
> my_mseq = MutableSeq("AAAATGA")
> my_mseq.count(1) 
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/lib64/python2.5/site-packages/Bio/Seq.py", line 722, in count
>     if len(search) == 1 :
> TypeError: object of type 'int' has no len()
> 
> Note that using a dict or list work but perhaps these should not. I think you
> need to check that 'search' is a string (isinstance(search,basestring)). If
> not, then fail with some more informative message. 

That's done in CVS.

Leaving this bug open to cover the test_GAQueens.py issue.


-- 
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the Biopython-dev mailing list