Skip to content

Commit

Permalink
Error text from len(None) depends on the version of python.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterc committed Mar 20, 2009
1 parent 7c3834c commit 7dcbf44
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Tests/output/test_SeqIO
Original file line number Diff line number Diff line change
Expand Up @@ -1873,11 +1873,11 @@ Testing reading qual format file Quality/example.qual
Checking can write/read as 'fasta' format
Failed: SeqRecord (id=EAS54_6_R1_2_1_443_348) has None for its sequence.
Checking can write/read as 'clustal' format
Failed: object of type 'NoneType' has no len()
Failed: Probably len() of None
Checking can write/read as 'phylip' format
Failed: object of type 'NoneType' has no len()
Failed: Probably len() of None
Checking can write/read as 'stockholm' format
Failed: object of type 'NoneType' has no len()
Failed: Probably len() of None
Checking can write/read as 'fastq' format
Failed: No sequence for record EAS54_6_R1_2_1_443_348
Checking can write/read as 'qual' format
Expand All @@ -1888,7 +1888,7 @@ Testing reading qual format file Quality/example.qual
Checking can write/read as 'tab' format
Failed: SeqRecord (id=EAS54_6_R1_2_1_443_348) has None for its sequence.
Checking can write/read as 'nexus' format
Failed: object of type 'NoneType' has no len()
Failed: Probably len() of None
Testing reading fastq format file Quality/example.fastq
ID and Name='EAS54_6_R1_2_1_413_324',
Seq='CCCTTCTTGTCTTCAGCGTTTCTCC', length=25
Expand Down
14 changes: 13 additions & 1 deletion Tests/test_SeqIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,19 @@ def check_simple_write_read(records, indent=" ") :
except (TypeError, ValueError), e :
#This is often expected to happen, for example when we try and
#write sequences of different lengths to an alignment file.
print indent+"Failed: %s" % str(e)
if "len()" in str(e) :
#Python 2.4.3,
#>>> len(None)
#...
#TypeError: len() of unsized object
#
#Python 2.5.2,
#>>> len(None)
#...
#TypeError: object of type 'NoneType' has no len()
print "Failed: Probably len() of None"
else :
print indent+"Failed: %s" % str(e)
assert format != t_format, \
"Should be able to re-write in the original format!"
#Carry on to the next format:
Expand Down

0 comments on commit 7dcbf44

Please sign in to comment.